Project 4, Problem 2 solution.