Simplified again the weighting algorithm