Cleaner metronome code