Add code from chapter 4.