Extract Search Pattern algorithm to separate class for re-use