Refactored isGameOver handling