mplement full state machine, #12