Template Engine refactored