Error fix: added setStateMachine method, otherwise state transitions
will not happen. Updated interface and tests for FSM threads.