Change state machine to use GoF Command Patern