done with pre-search algorithm