Added helper functions for FSM.