refactoring search