Added mode select and calibration routines.