chapter 2 source code