Started chapter 6 exercise 7 (hard)