general script tidying