chapter 6 code added