Refactor the render helper.

I've split things out to make the code clearer and more explicit. This also allows us to build our own helper around Sir Trevor in order to more easily customise how we render content.