Some state machine fixes. Getting closer to asynchronous server events.