Imroving the function computeWeightedMean(...).