small tidy up of script