update to template_setup.js

more descriptive error messagesd, refined regex for template ids