Updated parser and rewriter