implements end game