solved problem 7
problem 8