small refactoring search