Finite state machine and messaging