Added more chapter 4 code