anchor.diff:      end subroutine
       
       ! Advance by one time step
  +    ! @param deltaTime time step
       subroutine upwind_advect(obj, deltaTime)
  +    
           type(upwind_type) :: obj
           real(r8), intent(in) :: deltaTime
   
           real(r8), allocatable :: oldF(:)
           integer :: i, j, oldIndex, upI
           integer :: inds(obj % ndims)
  -
  -        ! omp parallel do
  +        
  +        ! allocate and copy the field (f95)
  +        oldF = obj % f
  +
  +        ! iterate over the cells
           do i = 1, obj % ntot
   
  +            ! compute the index set of this cell
               call upwind_getIndexSet(obj, i, inds)
   
  -                do j = 1, obj % ndims
  -                    oldIndex = inds(j)
  -                    ! periodic BCs
  -                    inds(j) = mod(inds(j) + obj % numCells(j) - 1, obj % numCells(j)) + 1
  +            ! iterate over the directions
  +            do j = 1, obj % ndims
  +                
  +                ! cache the cell index
  +                oldIndex = inds(j)
  +                
  +                ! increment the cell index
  +                inds(j) = inds(j) + obj % upDirection(j)
  +                
  +                ! apply periodic BCs
  +                inds(j) = mod(inds(j) + obj % numCells(j) - 1, obj % numCells(j)) + 1
  +                  
  +                ! compute the new flat index 
  +                call upwind_getFlatIndex(obj, inds, upI)
                       
  -                    call upwind_getFlatIndex(obj, inds, upI)
  +                ! update the field
  +                obj % f(upI) = obj % f(upI) - &
  +              &               deltaTime*obj % v(j)*obj % upDirection(j)*(oldF(upI) - oldF(i))/obj % deltas(j)
                       
  -                    obj % f(upI) = obj % f(upI) - &
  -       &  deltaTime * obj % v(j) * obj % upDirection(j) * (oldF(upI) - oldF(i))/ obj % deltas(j)
  -                    
  -                    inds(j) = oldIndex
  -                enddo
  +                ! reset the index
  +                inds(j) = oldIndex
  +           enddo
           enddo
   
       end subroutine
  
positive.code:     integer, intent(out)         :: stat
  
      read(str,*,iostat=stat) i
      
  end subroutine str2int
  
  program main
  
negative.code:     real(r8) :: lengths(ndims)
      real(r8) :: courant, dt, dx, val, chksum
      type(upwind_type) :: up
  
      numCells = -1
      
      ! default number of steps
      numTimeSteps = 100  
      argc = 0
      do 
  