tempalte refactoring