Added Dunkel's code to handle LEDs in main