rewriting script