Most of the code and functions from chapter 2. Pearson may not be correct.