Added chapter 3 code