add chapter 4 code examples