Generalised the script generation