Improved upon solution to problem 11.