added end game condition