Added end game logic