refactored template file