refactor rendering