Added more of the chapter 3 code