added calculation for mean and test to validate