Refactored SearchHandler