refactoring and render