Refactored search into its own class