Minimize green led flicker.  Breakup code into subroutines.