More improvements to calibration, now working only with doubles