final rewrite