change function endgame