finished chapter 7 - functional programming style