This calibration code is rubbish.