added calcmean and calcvar