refactoring searching