template logic added