Ajd chapter9

Chapter 9
Neat solution, if a little hard to read. I do understand it though.