Add checking for game end