insert working checkWin function