properly detects squares