Add end of the game detection