prior work trying to make this calibration routine function