Apply some refactoring related to Search method