finite state machine construction 6052291