Finished chapter 6 exercise 7