experimenting with state machines