updated checkSquare()