Now working state machine and game (though ugly)