Added code samples for chapter 4