Refactor search.