chapter 4 functions