Starting to refactor PatternDef