faster rewrite