nearly done with problem 1