Refactor search class