write functions for tab search