added proc rewriter