fixing update function #8
did some restructuring of logic in bin