added helper functions for search.