auto-calibration function added