rework on the search part to reduce the number of searches.