finished chapter 2 exercise 4