added rewriter framework