chapter 4, before render()