updates to chapter 2 code