search refactor