edits to chapter 1 code