anchor.diff:  		refac_syntax_lib:fold(F1, [], AnnAST) ++ FileAcc
   	   end,			 
       Acc =lists:foldl(F, [], Files),
  -    PNameAcc = lists:flatmap(fun({P,A}) -> if  P ==pname -> [A]; 
  -					       true -> []
  -					   end 
  -			     end, Acc), 
  -    PidAcc = lists:flatmap(fun({P,A}) -> if P == pid -> [A];
  -					    true -> [] 
  -					 end 
  -			   end, Acc), 
  -    SelfApps = lists:flatmap(fun({P,A}) -> if P == self -> [A];
  -					     true -> [] 
  -					   end 
  -			    end, Acc), 
  -    {Names, UnKnowns} = lists:partition(fun({Tag,_V})-> Tag==value end, PNameAcc),
  -    %%?wrangler_io("NamesUnKnowns:\n~p\n", [{Names, UnKnowns}]),
  -    {SelfApps, PidAcc, {lists:usort(lists:map(fun({value, P}) -> P end, Names)), lists:usort(UnKnowns)}}.
  +    PNameAcc  =[A||{pname, A}<- Acc],
  +    PidAcc = [A||{pid, A} <- Acc],
  +    SelfApps = [A||{self, A} <-Acc],
  +    Names = lists:usort([V||{value, V}<-PNameAcc]),
  +    UnKnowns = lists:usort([V||{unknown, V}<-PNameAcc]),
  +    {SelfApps, PidAcc, Names, UnKnowns}.
       
   
  -evaluate_expr(Files, ModName, AnnAST, FunDef, Expr) ->
  -    F = fun(E) ->
  -		Es = [refac_syntax:revert(E)],
  -		case catch erl_eval:exprs(Es, []) of 
  -		    {value, V, _} -> {value, V};
  -		    _ ->
  -			FunName = refac_syntax:data(refac_syntax:function_name(FunDef)),
  -			Arity = refac_syntax:function_arity(FunDef),
  -			{StartPos, _} = refac_util:get_range(Expr),
  -			{unknown, {ModName, FunName, Arity, StartPos}}
  -		end
  -	end,
  -    Exprs = case refac_util:get_free_vars(Expr) of 
  -		[] -> [Expr];
  -		_ ->  refac_slice:backward_slice(Files, AnnAST, ModName, FunDef, Expr)
  -	    end,
  -    Values = lists:map(F, Exprs),
  -    Values.
  -
  +evaluate_expr(FileName, Expr, SearchPaths, TabWidth) ->
  +    Val=refac_rename_fun:try_eval(FileName, Expr, SearchPaths, TabWidth),
  +    case Val of
  +	{value, V} -> [{value, V}];
  +	_ ->{{StartLine, _StartCol}, _} = refac_util:get_range(Expr),
  +	    [{unknown, {FileName, StartLine}}]
  +    end.
  +   
   
   is_recursive_fun({ModName, FunName, Arity, FunDef}, SearchPaths) ->
       case is_direct_recursive_fun(ModName, FunName, Arity, FunDef) of 
  
positive.code:  	  Operator = refac_syntax:application_operator(T),
   	  Ann = refac_syntax:get_ann(Operator),
   	  case lists:keysearch(fun_def, 1, Ann) of
   	    {value, {fun_def, {erlang, register, 2, _, _}}} -> true;
   	    _ -> false
   	  end;
         _ -> false
       end.
     
  is_self_app(T) ->
       case refac_syntax:type(T) of
         application ->
   	  Operator = refac_syntax:application_operator(T),
   	  Ann = refac_syntax:get_ann(Operator),
   	  case lists:keysearch(fun_def, 1, Ann) of
   	    {value, {fun_def, {erlang, self, 0, _, _}}} -> true;
   	    _ -> false
   	  end;
         _ -> false
       end.
  
  is_process_name(Name) ->
      refac_util:is_fun_name(Name) and (list_to_atom(Name) =/= undefined).
  
negative.code: %% Support the original function is f/n, then the new function name would be f/0 and the rpc function name would be f_rpc/2; if 
  %% any conflicts occur, '_i' will be attached to the end of the function name where i is a smallest number that make the name fresh.
  %% 
  pre_cond_check(AnnAST, Pos, ModName,FunName,Arity, ProcessName, SearchPaths, TabWidth)->
      {ok, FunDef} = refac_util:pos_to_fun_def(AnnAST, Pos),    
      case is_recursive_fun({ModName, FunName, Arity, FunDef}, SearchPaths) of  
  	true ->
  	    throw({error, "The function is a recursive (direct or indirect) function.\n"});
  	false -> ok
      end,
      {SelfApps, _Pids, PNames, UnKnowns} = collect_registration_and_self_apps(SearchPaths, TabWidth), 
      case lists:member(ProcessName, PNames) of 
  	true -> throw({error, "The process name provided is already in use, please choose another name."});
  	_ -> ok
      end,
      SelfRes = check_self_exprs(SelfApps, {ModName,FunName, Arity}, SearchPaths),
      case {UnKnowns, SelfRes} of
  	{[], []} -> ok;
  	{[], _} ->
  	    ?wrangler_io("\n*************************************Warning****************************************\n",[]),
  	    ?wrangler_io("The value returned by 'self()', which is used at the location(s) listed below, will be changed "
  			 " by this refactoring, and this could possibly change the behaviour of the program!\n",[]),
  	    lists:foreach(fun({{File, _Fun, _Ari}, SelfExpr, _}) ->
  				  {{Line,_}, _} = refac_util:get_range(SelfExpr),
  				  Msg = File ++ io_lib:format(":~p: \n",[Line]),
  				  ?wrangler_io(Msg, [])
  			  end, SelfRes),
  	    throw({undecidables, "there are undecidable cases."});
  	{_, []} -> 
  	    ?wrangler_io("\n*************************************Warning****************************************\n",[]),
  	    ?wrangler_io("Wrangler could not decide whether the process name provided conflicts with the process name(s) "
  			 "used by the following registeration expression(s):\n",[]),
  	    lists:foreach(fun({File,L}) ->
  				  Msg = File ++ io_lib:format(":~p: \n",[L]),
  				  ?wrangler_io(Msg, [])
  			  end, UnKnowns),
  	    throw({undecidables, "there are undecidable cases."});
  	_ ->
  	    ?wrangler_io("\n*************************************Warning****************************************\n",[]),
  	    ?wrangler_io("Wrangler could not decide whether the process name provided conflicts with the process name(s) "
  			 "used by the following registeration expression(s):\n",[]),
  	    lists:foreach(fun({File,L}) ->
  				  Msg = File ++ io_lib:format(":~p: \n",[L]),
  				  ?wrangler_io(Msg, [])
  			  end, UnKnowns),
  	    ?wrangler_io("\n*************************************Warning****************************************\n",[]),
  	    ?wrangler_io("The value returned by 'self()', which is used at the location(s) listed below, will be changed "
  			 " by this refactoring, and this could possibly change the behaviour of the program!\n",[]),
  	    lists:foreach(fun({{File, _Fun, _Ari}, SelfExpr, _}) ->
  				  {{Line,_}, _} = refac_util:get_range(SelfExpr),
  				  Msg = File ++ io_lib:format(":~p: \n",[Line]),
  				  ?wrangler_io(Msg, [])
  			  end, SelfRes),
  	    throw({undecidables, "there are undecidable cases."})
      end.
    
  		 
  	    
  
  