Finite state machine improvements