Rewrite script