refactored templates for more efficient routing