more work on state machines