Refactor page render