added more features to the calibrate code