crude optimization to reuse patterns
further reduction in the amount of useless generated code