Code to work out overall standings