assignment 4 - refine problem 1