tweak to template logic