Added calculation of confidence intervals (incomplete)