Simplify pattern-generated code