centralize the input handling
a fsm transition can end the machine