Separated frame creation and calibration into two different functions