Search refactoring