For one, you can use 'For each', then check your condition. That forces C2 to look at each of your objects individually, rather than lumping them together. Second, a simple state machine typically uses an integer, which you set to constants. So have const: ROAMING=1, FOUND=2, etc. Then you just check each of these values to see what state you are in, and process accordingly. This is similar to the Switch concept.