refactored xMeanOf to xMeanBy