set names on template through underscore.script, some refactoring