added an untested calibrate function