anchor.diff:  		  end
   	  end,
       Cs2= lists:append(lists:map(Fun, Cs)),
  +    io:format("Type3:\n~p\n",[length(Cs2)]),
       Cs3 =[lists:map(fun(C) -> {C, Len, length(C)} end, group_by(2, lists:map(Fun0, Range)))
   		    || {Range, Len, _F}<- Cs2],
       Cs4 = lists:append(Cs3),
  
positive.code: 
  %% combine clones which are next to each other. (ideally a fixpoint should be reached).
  combine_neighbour_clones(Cs, MinLength, MinClones) ->
      Cs1 = combine_neighbour_clones(Cs, []),
      Cs2= [{R, L, F} || {R, L, F} <-Cs1, L >= MinLength, F >=MinClones],
      remove_sub_clones(Cs2).
  		   
  combine_neighbour_clones([], Acc) -> Acc;
  combine_neighbour_clones([C|Cs], Acc) ->
      C1 = case Acc of 
  	     [] -> [C] ;
  	     _ -> lists:map(fun(Clone)-> connect_clones(C, Clone) end, Acc)
  	 end,
      C2 = lists:usort(C1),
      combine_neighbour_clones(Cs, Acc++C2).
  			   
  
  connect_clones(C1={Range1, Len1, F1}, {Range2, Len2, F2}) ->  %% assume F1=<F2.
       StartLocs1 = lists:map(fun({S,_E}) -> S  end, Range1),
       EndLocs1 = lists:map(fun({_S, E}) -> E end, Range1),
       StartLocs2 = lists:map(fun({S,_E}) -> S  end, Range2),
       EndLocs2 = lists:map(fun({_S, E}) -> E end, Range2),
       case F1 =< F2 of 
  	 true
  	   -> case lists:subtract(StartLocs1, EndLocs2) of 
  		  [] -> R1 = lists:filter(fun({_S, E}) -> lists:member(E, StartLocs1) end, Range2),
  			R2= lists:map(fun({S, _E}) -> S end, R1),
  			{lists:zip(R2, EndLocs1), Len1+Len2, F1};
  		  _  -> 
  		      case lists:subtract(EndLocs1, StartLocs2) of 
  			  [] -> R3= lists:filter(fun({S,_E}) ->lists:member(S, EndLocs1) end, Range2),
  				R4 = lists:map(fun({_S,E}) -> E end, R3),
  				{lists:zip(StartLocs1, R4), Len1+Len2, F1};
  			  _ -> C1
  		      end
  	      end; 
  	 _  -> C1
       end.
  
  
  %%================================================================================
  
negative.code: 
  duplicated_code(DirFileList, MinLength1, MinClones1) ->
      io:format("\nCMD: ~p:duplicated_code(~p,~p,~p).\n", [?MODULE, DirFileList, MinLength1, MinClones1]),
      ?debug("current time:~p\n", [time()]),
      start_suffix_tree_clone_detector(),
      {Cs5, _FileNames} = duplicated_code_detection(DirFileList, MinClones1, MinLength1),
      ?debug("Filtering out sub-clones.\n", []),
      Cs6 = remove_sub_clones(Cs5),
      stop_suffix_tree_clone_detector(),
      ?debug("current time:~p\n", [time()]),
      %% case length(FileNames) of
      %%     1 -> display_clones(Cs6);
      %%     _ -> display_clones1(Cs6)
      %%  end,
      io:format("No of Clones found:\n~p\n", [length(Cs6)]),
      io:format("Clones:\n~p\n", [Cs6]),
      {ok, "Duplicated code detection finished."}.
  
  -spec(duplicated_code_1/3::(dir(), [integer()], [integer()]) ->
  