anchor.diff:  	enddo
   end subroutine
   
  +subroutine FlagPanelsForTransitionRefinement( refineFlag, aMesh, remesh, startIndex, counter )
  +	logical(klog), intent(inout) :: refineFlag
  +	type(SphereMesh), intent(inout) :: aMesh
  +	type(RemeshSetup), intent(in) :: remesh
  +	integer(kint), intent(in) :: startIndex
  +	integer(kint), intent(inout) :: counter
  +	!
  +	integer(kint) :: adjPanels(8), adjNestLevels(8), nAdj, j, k
  +	type(Panels), pointer :: aPanels
  +	
  +	aPanels=>aMesh%panels
  +	
  +	do j = 1, aPanels%N
  +		if ( .NOT. aPanels%hasChildren(j) ) then
  +			call FindAdjacentPanels(adjPanels, nAdj, aMesh, j)
  +			do k = 1, nAdj
  +				adjNestLevels(k) = aPanels%nest( adjPanels(k) )
  +			enddo	
  +			if ( maxval(adjNestLevels) - aPanels%nest(j) >= 2 ) then
  +				refineFlag(j) = .TRUE.
  +				counter = counter + 1
  +			endif
  +		endif
  +	enddo
  +end subroutine
  +
   subroutine FlagPanelsForFLowMapRefinement(refineFlag, amesh, remesh, startINdex, counter)
   	logical(klog), intent(inout) :: refineFlag(:)
   	type(SphereMesh), intent(in) :: aMesh
  
positive.code: 							endif
  							call FlagPanelsForTracerVariationRefinement(refineFlag, newMesh, remesh, startIndex, counters(5))
  						endif
  
  						refineCount = count(refineFlag)
  						spaceLeft = newPanels%N_Max - newPanels%N
  
negative.code: 		call FlagPanelsForTracerVariationRefinement(refineFlag, aMesh, remesh, startIndex, counters(5))
  	endif
  
  	call FlagPanelsForTransitionRefinement( refineFlag, aMesh, remesh, startIndex, counters(6) )
  	
  	refineCount = count(refineFlag)
  	spaceLeft = aPanels%N_Max - aPanels%N
  
  