Added code to complete Chapter 4