first rewrite