Adds refactoring to render()