Add Apply in WeightedMean, added checks, corrected documentation, code format, improved atomic function