Rewrote LED control logic.  Not yet tested.