First attempt to create a working state machine.