added state machine testing code