Problem 9
Implemented problem 10