corrected chapter 6 as suggested by chris
chapter 7 fixed