all code up to section 6.2
completed chapter 6, section 1