Improved UpdateWeights procedure