Adding chapter 7 code