Search refactor