Submitting problem 2.2
Improved the modularity of some of the items. Submitting answer to 2.2. I don't like the book's solution, but granted my solution is less readable