refactoring search in app