More refactoring to the render method.