begins endgame functionality