mean and median implementations.