change template logic