made the search to work on already ordered data