modify checkWins function