turn pattern() into an extractor class method, getting rid of the previous hack