Design Pattern State Machine