Added some missing code in chapter 2