refactor for renderer