Refactor isSquare and thingsAt