Refactoring of the rendering code.