Chapter 7, and Alternative

Adds chapter 7's work the way the book suggests it should be. I also
provided an alternative with a header file that I feel is much cleaner.