Refactored view to use template