Render refactor (with couple of fixes)

Maybe put function after variable declaration and new()? Also, this seems like a good candidate for inline.