Moved calibration code to main class