completed calibration code