framing out state machine