clean up problem 9 code