added def end_game