Beginning of calibration code