Nice write-up on what state machine are and how they work. I am mixed on state machines, in some cases they are useful. But I have found over the years that many layer state machines can lead to lots of bugs in the future. If its a few layers deep, not so bad.