Added Chapter 4 code