added state machine to game