Added red/green calibration code and implemented switch depending on color.