added checkForWin helper method for readability