moved state machine builder