Added Check_for_end_of_game logic