updating statistics correctly
Now with weighting