Added the rest of Chapter 4's code