Modif for exhaustive_search function