add code to chapter 10 exercises