put our extracted methods back into inputData().
changed machine[theMachine] to currentMachine.
Moved some logic from changeState() into Machine.