rewrite scripts