Fix bugs in the weighting.  Contribution per loop is sum(weights), not
sum(1/weights)