Hoist function definition towards the top of `renderView()` for clarity.