added mean and median functions