assgn5 with problems with exiting condition(when work is done)