more tidying up, script fixes