first pass of problem 5