basic patch rewriting script ready