added rewrite script