anchor.diff:  gen_fun_1(SideEffect, FileName,ParName, FunName, Arity, DefPos, Exp, TabWidth, Editor) ->
       %% somehow I couldn't pass AST to elisp part, as some occurrences of 'nil' were turned into '[]'.
       {ok, {AnnAST, Info}} = refac_util:parse_annotate_file(FileName,true, [],TabWidth),  
  +    {ok, ModName} = get_module_name(Info),
       R = refac_util:is_exported({FunName, Arity}, Info),
  -    AnnAST1 = if R  -> add_function(AnnAST, FunName,DefPos, Exp, SideEffect);
  +    AnnAST1 = if R  -> add_function(ModName, AnnAST, FunName,DefPos, Exp, SideEffect);
   	       true -> AnnAST
   	    end,		       
  -    {AnnAST2, _} = refac_util:stop_tdTP(fun do_gen_fun/2, AnnAST1, {ParName, FunName, Arity, DefPos,Info, Exp,SideEffect}),
  +    {AnnAST2, _} = refac_util:stop_tdTP(fun do_gen_fun/2, AnnAST1, {ModName, ParName, FunName, Arity, DefPos,Info, Exp,SideEffect}),
       case Editor of 
   	emacs ->
   	    refac_util:write_refactored_files([{{FileName,FileName}, AnnAST2}]),
  
positive.code:     case refac_util:is_var_name(ParName) of 
  	true ->
  	    {ok, {AnnAST, Info}} =refac_util:parse_annotate_file(FileName,true, SearchPaths, TabWidth),
  	    case refac_util:pos_to_expr(AnnAST, Start, End) of  
  		{ok, Exp1} ->{ok, Fun} = refac_util:expr_to_fun(AnnAST, Exp1),
  			     FunName = refac_syntax:data(refac_syntax:function_name(Fun)),
  			     FunArity = refac_syntax:function_arity(Fun),
  			     Inscope_Funs = lists:map(fun({_M1,F, A})->{F, A} end, 
  						      refac_util:inscope_funs(Info)),
  			     case lists:member({FunName, FunArity+1}, Inscope_Funs) of 
  				 true ->{error, "Function "++ atom_to_list(FunName)++"/"++
  					 integer_to_list(FunArity+1)++" is already in scope!"};
  				 _   -> FunDefPos =get_fun_def_loc(Fun), 
  					ParName1 = list_to_atom(ParName),
  					case gen_cond_analysis(Fun, Exp1, ParName1) of 
  					    ok -> 
  						SideEffect = refac_util:has_side_effect(FileName, Exp1, SearchPaths),
  						case SideEffect of  
  						    unknown -> {unknown_side_effect, {ParName1, FunName, FunArity, FunDefPos,Exp1}};
  						    _ ->AnnAST1=gen_fun(AnnAST, ParName1, 
  									FunName, FunArity, FunDefPos,Info, Exp1, SideEffect),
  							case Editor of 
  							    emacs ->
  								refac_util:write_refactored_files([{{FileName,FileName}, AnnAST1}]),
  								{ok, "Refactor succeeded"};
  							    eclipse  ->
  								Res = [{FileName, FileName, refac_prettypr:print_ast(refac_util:file_format(FileName),AnnAST1)}],
  								{ok, Res}
  							end
  						end;	     
  					    {error, Reason} -> {error, Reason}
  					end 
  			     end;
  		{error, Reason} -> {error, Reason}
  	    end;
  	false  -> {error, "Invalid parameter name!"}
  
negative.code: gen_fun_2(FileName, ParName1, FunName, FunArity, FunDefPos, Exp, SearchPaths,TabWidth, Editor) ->
      %% somehow I couldn't pass AST to elisp part, as some occurrences of 'nil' were turned into '[]'.
      {ok, {AnnAST, Info}} = refac_util:parse_annotate_file(FileName,true, SearchPaths, TabWidth),
      {ok, ModName} = get_module_name(Info),
      SideEffect = refac_util:has_side_effect(FileName, Exp, SearchPaths),
      case SideEffect of  
  	false ->AnnAST1=gen_fun(ModName, AnnAST, ParName1, 
  				FunName, FunArity, FunDefPos,Info, Exp, SideEffect),
  		case Editor of 
  		    emacs ->
  