refactor search for improving neighbor.