added auto calibration