rewrite of script