Added missing function medianAndAvgByPeriod.