Finished the first exercise at the end of Chapter 3