first pass of problem 3