fixing up chapter 8, formatting and comments