Exercise #7 solution.