Refactor LED on-off using 'functions'