And while on Finite State Machine, here is a great tutorial on this subject by Tracey Allen:

http://emesystems.com/OLDSITE/BS2fsm.htm

Ioannis