allow a template_dir parameter in place of the hardcoded directory