added end game functionality