Initial code for chapter 2