finished chapter 2 coding