added calibration, cleaned up many warnings