added region rewriter