cleaned up problem 7 a bit