anchor.diff:  	     NewLen = Len-length(Str1) -length(Str21),
   	     case NewLen >= MinLen*2-1 of
   		 true ->
  -		     split_a_clone({NewRanges,{NewLen, F}},lists:reverse(Str22), MinLen);
  +		     split_a_clone({NewRanges,{NewLen, F}},lists:reverse(Str22), MinLen, MinFreq);
   		 _ -> []
   	     end	    
       end.
   
  -split_a_clone(_, "", _)->[];
  -split_a_clone({Ranges, {Len, F}}, Str, MinLen) ->
  +split_a_clone(_, "", _, _)->[];
  +split_a_clone({Ranges, {Len, F}}, Str, MinLen, MinFreq) ->
       {Str1, Str2} = lists:splitwith(fun(C) -> C=/=$# end, Str),
  -    Len1 = length(Str1),
  -    {NewRanges, RemainedRanges} = lists:unzip([{{S, S+Len1-1}, {S+Len1+1, E}}
  +    Len1 = case lists:last(Str1) of 
  +	       $, ->length(Str1)-1;
  +	       _ -> length(Str1)
  +	   end,
  +    {Str21, Str22} = lists:splitwith(fun(C) -> C==$# end, Str2),
  +    {NewRanges, RemainedRanges} = lists:unzip([{{S, S+Len1-1}, {S+length(Str1)+length(Str21), E}}
   					       ||{S, E} <-Ranges]),
  -     case Str2 of 
  -	"" ->
  -	    case Len1>= MinLen*2-1  of
  -		true -> [{NewRanges, {Len1, F}}];
  -		false -> []
  +    case Len1 >= MinLen*2-1 of 
  +	true ->
  +	    NewRanges1 = remove_overlapped_ranges(NewRanges),
  +	    NewFreq = length(NewRanges1),
  +	    case NewFreq>=MinFreq of
  +		true ->
  +		    case Str22 of 
  +			"" ->[{NewRanges1, {Len1, NewFreq}}];
  +			_ ->   [{NewRanges1, {Len1, NewFreq}} | split_a_clone({RemainedRanges, {Len, F}}, Str22, MinLen,MinFreq)]
  +		    end;
  +		false ->
  +		    case Str22 of 
  +			"" ->
  +			    [];
  +			_ -> 
  +			    split_a_clone({RemainedRanges, {Len, F}}, Str22, MinLen,MinFreq)
  +		    end
   	    end;
  -	[$#|Str3] ->
  -	    case Len1>= MinLen*2-1 of
  -		true ->
  -		    [{NewRanges, {Len1, F}} | split_a_clone({RemainedRanges, {Len, F}}, Str3, MinLen)];
  -		false ->
  -		    split_a_clone({RemainedRanges, {Len, F}}, Str3, MinLen)
  -	    end	    
  -    end.
  +	false ->
  +	    case Str22 of 
  +		"" ->
  +		    [];
  +		_ -> 
  +		    split_a_clone({RemainedRanges, {Len, F}}, Str22, MinLen,MinFreq)
  +	    end
  +    end.
  +
      
  -
  +remove_overlapped_ranges(Rs) ->
  +    Rs1 = lists:sort(Rs),
  +    R = hd(Rs1),
  +    remove_overlapped_ranges(tl(Rs1), R, [R]).
  +remove_overlapped_ranges([], _ , Acc) ->
  +    lists:reverse(Acc);
  +remove_overlapped_ranges([{S, E}|Rs], {S1, E1},Acc) ->
  +      case (S1=<S) andalso (S=<E1) of 
  +	true ->
  +	   remove_overlapped_ranges(Rs, {S1, E1}, Acc);
  +	false ->
  +	    remove_overlapped_ranges(Rs, {S, E}, [{S, E}|Acc])
  +    end.
  +	     
  +    
   get_clones_in_ranges(Cs, Data, MinLen, MinFreq, RangeTab) ->
       F0 = fun({S, E}) ->
   		 {_, Ranges}=lists:unzip(lists:sublist(Data, S, E-S+1)),
  
positive.code:     refac_util:add_category(refac_util:add_fun_define_locations(AnnAST0, Info)).
   
  
  
negative.code: 			ets:insert(RangeTab, {{MFA, S1, E2}, R}),
  			{MFA, S1, E2}
  		  end ||R<-Rs]
  	 end,	
      F= fun({Ranges, {_Len, Freq}}) ->
  	       case Freq>=MinFreq of 
  		   true -> 
  		       NewRanges0 = [F0(R)|| R <- Ranges],
  		       NewRanges = zip(NewRanges0),
  		       [{F1(Rs),{length(hd(Rs)), Freq}}|| Rs <-NewRanges];
  		   _ ->[]
  	       end
         end, 
      Res =[lists:reverse(F(C)) || C<-Cs],
      remove_duplicated_clones(Res,[]).
  
  
  remove_duplicated_clones([], Acc) ->
       lists:reverse(Acc);
  remove_duplicated_clones([Cs|T], Acc) ->
      Cs1 =[{Ranges, {Len, Freq}}|| {Ranges, {Len, Freq}}<-Cs,
  		not(lists:any(fun(Cs2) ->
  				      lists:any(fun({Ranges1, {Len1, Freq1}}) ->
  							(Len==Len1) andalso (Freq =<Freq1) 
  							    andalso  (Ranges--Ranges1==[])
  						end, Cs2)
  			      end, Acc))],
      remove_duplicated_clones(T, [Cs1|Acc]).
  			  
  
  
  
  zip(L) ->[nested_tuple_to_list(E)||E<-zip_1(L)].
  zip_1([]) ->[];
  zip_1([L]) ->L;
  