Finish chapter 3 exercise