Start to implement chapter 7 code