Finish up code for chapter 7