Implemented manual calculation of mean and rms.