committing some of the chapter 6 exercises