Nearly done code for Chapter 7.