function definitions for stub matching