Symmetry detection code