Added proper game end handling