refactored views into templates