anchor.diff:  
       ! loop over all surfaces
       dist = INFINITY
  -    do i = 1, n_surfaces
  +    do i = 1, n_surf
          if (i <= n1) then
             ! in local cell, so use xyz_local
             x = p % xyz_local(1)
  
positive.code: 
      integer, allocatable :: expression(:) ! copy of surface list
      integer :: i            ! index for surface in cell
      integer :: n_surfaces   ! total number of surfaces to check
      integer :: n1           ! number of surfaces in current cell
      integer :: n2           ! number of surfaces in parent cell
      integer :: index_surf   ! index in surfaces array (with sign)
  
negative.code: 
      current_surface = p % surface
  
      n_surf = size(c % surfaces)
      allocate(expression(n_surf))
      expression = c % surfaces
      do i = 1, n_surf
  
         ! Don't change logical operator
         if (expression(i) >= OP_DIFFERENCE) then
  