Some more code from chapter 2