Added problem 9 solution.  Refactored problem 8.