Adds base of chapter 5 code