Mean function added