improved lostgame code