templates refactor