Completed problem 11 (intermediate)