calibration code from Amina