anchor.diff:                                     aStoneLocs: TKMPointList);
   var
     I: Integer;
  -  ValidTiles: TKMPointList;
  +  validTiles: TKMPointList;
     P: TKMPoint;
   begin
  -  ValidTiles := TKMPointList.Create;
  +  validTiles := TKMPointList.Create;
     try
  -    fFinder.GetTilesWithinDistance(aLoc, aRadius, tpWalk, ValidTiles);
  -
  -    for I := 0 to ValidTiles.Count - 1 do
  +    fFinder.GetTilesWithinDistance(aLoc, aRadius, tpWalk, validTiles);
  +
  +    for I := 0 to validTiles.Count - 1 do
       begin
  -      P := ValidTiles[I];
  +      P := validTiles[I];
         if (P.Y >= 2) //Can't mine stone from top row of the map (don't call TileIsStone with Y=0)
           and not KMSamePoint(aAvoidLoc, P)
           and TileHasStone(P.X, P.Y - 1)
  
positive.code: 
  var
    I, K: Word;
    Avg: Word;
  begin
    Assert(TileInMapCoords(Loc.X, Loc.Y), 'Can''t flatten tile outside map coordinates');
  
  
negative.code:           SecondBestToPlant.Add(T); //Empty space and other objects that can be dug out (e.g. mushrooms) if no other options available
      end;
    end;
    validTiles.Free;
  end;
  
  
  procedure TKMTerrain.FindPossibleTreePoints(const aLoc: TKMPoint; aRadius: Word; aTiles: TKMPointList);
  var
    validTiles: TKMPointList;
    I: Integer;
    T: TKMPoint;
    cuttingPoint: TKMPointDir;
  begin
    validTiles := TKMPointList.Create;
    try
      //Scan terrain and add all trees/spots into lists
      fFinder.GetTilesWithinDistance(aLoc, aRadius, tpWalk, validTiles);
      for I := 0 to validTiles.Count - 1 do
      begin
         //Store in temp variable for speed
        T := validTiles[I];
  
        if (KMLengthDiag(aLoc, T) <= aRadius)
          and Route_CanBeMadeToVertex(aLoc, T, tpWalk)
          and ChooseCuttingDirection(aLoc, T, cuttingPoint) then
          aTiles.Add(T);
      end;
    finally
      validTiles.Free;
    end;
  end;
  
  