refactoring of the rendering methods.