fixed overflow warning in calibration, added functionality to paintGrid