Cleaning up the TreeRewriter