beginning rewrite