anchor.diff:  	end,
       lists:usort(refac_syntax_lib:fold(F, [], FunDef)).
   
  -
  -check_records(FileName, TargetFileName, FunDef, SearchPaths, TabWidth) ->
  -    UsedRecords = collect_used_records(FunDef),
  -    case UsedRecords of 
  -	[] -> true;
  -	_ ->
  -	    {ok, {_, Info}} =refac_util:parse_annotate_file(FileName,false, SearchPaths, TabWidth),
  -	    case lists:keysearch(records, 1, Info) of
  -		{value, {records, RecordDefs}} -> 
  -		    UsedRecordDefs = [{Name, lists:keysort(1,[{F, format(FDef)} || {F, FDef} <-Fields])}
  -				      || {Name, Fields} <-RecordDefs, lists:member(Name, UsedRecords)],
  -		    case length(UsedRecords) > length(UsedRecordDefs) of 
  -			true ->
  -			    UnDefinedUsedRecords = UsedRecords -- [Name || {Name, _Fields} <- UsedRecordDefs],
  -			    ?wrangler_io("\nThe following records are used by the function to be moved, but not defined:~p\n", [UnDefinedUsedRecords]),
  -			    throw({error, "There are undefined records used by the function to be moved."});
  -			_ -> {ok, {_, Info1}} = refac_util:parse_annotate_file(TargetFileName, false, SearchPaths, TabWidth),
  -			     case lists:keysearch(records,1, Info1) of 
  -				 {value, {records, RecordDefsInTargetFile}} ->
  -				     UsedRecordDefsInTargetFile = [{Name, lists:keysort(1,[{F, format(FDef)} || {F, FDef} <-Fields])}
  -								   || {Name, Fields} <-RecordDefsInTargetFile,
  -								      lists:member(Name, UsedRecords)],
  -				     case length(UsedRecords) > length(UsedRecordDefsInTargetFile) of 
  -					 true -> throw({error, "Some records used by the function are not defined in the taret file."});
  -					 _ -> case lists:keysort(1, UsedRecordDefs) == lists:keysort(1, UsedRecordDefsInTargetFile) of 
  -						  true ->true;
  -						  _  -> throw({error,  "Moving this function could change program semantics because of different record definitions."})
  -					      end
  -				     end;
  -				 _ ->throw({error, "Some record(s) used by the function to be moved are not defined in the target file."})
  -			     end
  -		    end;
  -		_ ->
  -		    throw({error, "Refactoring failed because of incomplete information about the record(s) used by this function."})
  -	    end
  -    end.
  -					
  -	    
  -format(none) ->
  -    none;
  -format(Node) -> refac_prettypr:format(Node).
  -	    
   collect_used_records(FunDef) ->
       F = fun(T, S) ->
   		case refac_syntax:type(T) of 
  
positive.code: 	end,
      lists:usort(refac_syntax_lib:fold(F,[], FunDef)).
  		
  			
  reset_attrs(Node, {M, F, A}) ->
      Fun = fun(T) -> 
  		  T1 = case refac_syntax:type(T) of 
  
negative.code:     TargetModName = case filename:extension(TargetModorFileName) of 
  			".erl" -> filename:basename(TargetModorFileName, ".erl");
  			[] -> TargetModorFileName;
  			_ -> throw(ErrMsg)			
  		    end,
      case refac_util:is_fun_name(TargetModName) of 
  	true -> {filename:join([filename:dirname(CurrentFName), TargetModName++".erl"]), list_to_atom(TargetModName)};
  	_  -> throw(ErrMsg)
      end.
  
  
  create_new_file(TargetFName, TargetModName) ->
      S = "-module("++atom_to_list(TargetModName)++").",
      file:write_file(TargetFName, list_to_binary(S)).
  
  side_cond_check({FileName, ModName, FunName, Arity}, TargetFileName, TargetModName, FunDef, SearchPaths, TabWidth) ->
      {ok, {AnnAST, Info}} = refac_util:parse_annotate_file(TargetFileName, true, SearchPaths, TabWidth),
      InscopeFuns = refac_util:inscope_funs(Info),
      check_macros_records(FileName, TargetFileName, FunDef, SearchPaths, TabWidth),
      Clash = lists:any(fun ({M, F, A}) ->
  			      ({FunName, Arity} == {F, A}) andalso (ModName =/= M)
  		      end, InscopeFuns),
      case Clash of
        true ->
  	    Forms = refac_syntax:form_list_elements(AnnAST),
  	    FunWithSameName = [F || F <- Forms, defines(F, {TargetModName, FunName, Arity})],
  	    case FunWithSameName of
  		[] ->
  		    {error, "Moving this function will cause confliction in the target module."};
  		[F] -> case is_the_same_fun(FunDef, F) of
  			   true -> true;
  			   _ -> {error, "The same function name, with a possibly different definition, is already defined in the target module."}
  		       end
  	    end;
  	false -> true
      end.
  
  defines(Form, {M, F, A}) ->
      case refac_syntax:type(Form) of
  	function ->
  	  case lists:keysearch(fun_def, 1, refac_syntax:get_ann(Form)) of
  	      {value, {fun_def, {M, F, A, _, _}}} ->
  		  true;
  	      _ -> false
  	  end;
  	_ -> false
      end.
   
  
  is_the_same_fun(FunDef1, FunDef2) ->
      Ann1 = refac_syntax:get_ann(FunDef1),
  