calibration code clean up