anchor.diff:               flag = .false.; exit
             endif
             a(sitePointer) = a(sitePointer) + 1 ! Advance the current digit
  -          if (a(sitePointer) > k-1) then      ! Reset the label to zero  
  +          if (a(sitePointer) > k-1) then      ! Reset the label to zero
                a(sitePointer) = -1             ! and back up one digit
  -             sitePointer = sitePointer - 1  
  +             sitePointer = sitePointer - 1
                cycle
             endif
             if(E(sitePointer,a(sitePointer)+1)==1) exit ! Found a valid
  
positive.code:     endif
      lab = ""
      nPerm = size(perm,1)
      
      ! Initialize the mask (E) used to prune the tree to meet site restrictions 
      allocate(E(n*nD,k))
      E = 0
      do ik = 1, k; do iD = 1, n*nD ! loop over all "colors" and all "sites"
  
negative.code:     integer, allocatable :: trivPerm(:), tM(:,:,:)
      real(dp) :: eps
      integer, dimension(3,3) :: M
  
      nH = size(HNF,3) ! Number of HNFs
      ! Find the maximum number of symmetries for the list of HNFs
      nR = 48 ! debug
  