Dude. Just use a state machine.