Untested implementation of calibration with kill switch check.
Changes by Mark and Evan from July 2nd.