Added a simple State Machine class.