add end game functionality