Sorry, my screen at home is too small to really look at your VI, but there are some strange constructs. For example, how is the loop with the event structure supposed to complete? Shouldn't there also be an event for the boolean? Why do you use integers instead of the correct enum to define the next state?