Update autocalibration code (again!)