Untested solution to problem 8
Solution to problem 8