fsm running the for loop