Like the current_while timer, suggest breaking this up into enable/disable functions. Also for consistency use "timer" rather than "machine" in the name.