added handling of game win condition