refactoring rendering structure