refactored template out of view