improve multi-turn mass calibration code