chapter 2 exercises, partially done