My comment apply for all the changeset in the file. I would make another PR for such refactoring. I think this PR should contain only code related to search.