latest psevdocode implementation the calibration with open connections is also implemented