anchor.diff:      integer, allocatable :: expression(:) ! copy of surfaces list
       integer :: specified_sense ! specified sense of surface in list
       integer :: actual_sense    ! sense of particle wrt surface
  -    integer :: n_surfaces      ! number of surfaces in cell
  +    integer :: n_surf          ! number of surfaces in cell
       integer :: i               ! index of surfaces in cell
       integer :: surf_num        ! index in surfaces array (with sign)
       integer :: current_surface ! current surface of particle (with sign)
  
positive.code: 
      ! loop over all surfaces
      dist = INFINITY
      do i = 1, n_surfaces
         if (i <= n1) then
            ! in local cell, so use xyz_local
            x = p % xyz_local(1)
  
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
  