tool rewrite