move state changes out of main loop, keep main loop simple. Bug in front LED code