Bit more tidying on the main script