additions to rewrite