Improved Naming function for Template Router

Faster and more readable algorithm.