Refactor view rendering