Solution using object