chapter 2 revised + code