Finished chapter 9 exercise 9