anchor.diff:  
          call swap(x, iWidth_, iLength_, iType_, iNumber_, item, iend + 1)
   
  -       nItems = nItems + 1
  -
  -       iend = iend + 1
  -       
  -       iType   => iType_(iini:iend)
  -       
  -       iNumber => iNumber_(iini:iend)
  -       
  -       iWidth  => iWidth_(iini:iend)
  -       
  -       iLength => iLength_(iini:iend)
  +       call updateCurrItems(iini, iend + 1)
  +
  +!!$       nItems = nItems + 1
  +!!$
  +!!$       iend = iend + 1
  +!!$       
  +!!$       iType   => iType_(iini:iend)
  +!!$       
  +!!$       iNumber => iNumber_(iini:iend)
  +!!$       
  +!!$       iWidth  => iWidth_(iini:iend)
  +!!$       
  +!!$       iLength => iLength_(iini:iend)
   
          !write(*,*), iNumber_(item), iNumber(nItems)
   
  
positive.code: 
      end do
  
      iini = 1
  
      iend = nTItems
  
      nItems = nTItems
  
      iType   => iType_(iini:iend)
  
      iNumber => iNumber_(iini:iend)
  
      iLength => iLength_(iini:iend)
  
      iWidth  =>  iWidth_(iini:iend)
  
      deallocate(types, tL, tW)
  
  
negative.code: 
      end if
  
  !!$    iini = iini + nit
  !!$
  !!$    iend = nTItems
  !!$
  !!$    nItems = iend - iini + 1
  !!$
  !!$    iType   => iType_(iini:iend)
  !!$
  !!$    iNumber => iNumber_(iini:iend)
  !!$
  !!$    iWidth  => iWidth_(iini:iend)
  !!$
  !!$    iLength => iLength_(iini:iend)
  
      call updateCurrItems(iini + nit, nTItems)
  
    end subroutine removeItems
    
  ! ******************************************************************
  ! ******************************************************************
  
    subroutine updateCurrItems(niini, niend)
  
      ! This subroutine updates which items are currently being
      ! considered for optimization and packing.
  
      implicit none
  
      ! SCALAR ARGUMENTS
      integer, intent(in) :: niini, niend
  
      iini = niini
  
      iend = niend
  
      nItems = iend - iini + 1
  
      iType   => iType_(iini:iend)
  
      iNumber => iNumber_(iini:iend)
  
      iWidth  => iWidth_(iini:iend)
  
      iLength => iLength_(iini:iend)
  
    end subroutine updateCurrItems
  
  ! ******************************************************************
  ! ******************************************************************
  
  