add efficient mean and median for ranges