Use State Machines!

FSMs are not as complex as you think and they make your code better.

You might also be interested in these articles...

Richard Clayton

Unrepentant Thoughts on Software and Management.