templates refactored