correcting scripts to make the more general case