completed refactoring of all templates