Added modular logic to determine whether or not to play a note