Refactor render