Refactor motor calibration