new template logic