adding changes from chapter 2. at the end of chapter 2