refactoring render