functions recorded from chapter 3