Cleanup of code and fixed led light to turn off.