Added more code to Chapter 4