anchor.diff:  	    FreeVars = lists:map(fun({V,_}) -> V end, refac_util:get_free_vars(Exp)),
   	    Pars  = lists:map(fun(P) ->refac_syntax:variable(P) end, FreeVars),
   	    case SideEffect of 
  -			false -> case FreeVars==[] of 
  +		false -> case FreeVars==[] of 
   			     true ->{refac_syntax:variable(ParName), true};
   			     _ -> Op1 = refac_syntax:operator(ParName),
   				  {refac_syntax:application(Op1, Pars), true}
  
positive.code:     {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}]),
  	    {ok, "Refactor succeeded"};
  	eclipse ->
  	    Res = [{FileName, FileName, refac_prettypr:print_ast(refac_util:file_format(FileName),AnnAST2)}],
  
negative.code: 	_ -> {Tree, false}
      end.
  
  gen_fun_clause(FileName, ParName, FunName, Arity, DefPos, Exp, TabWidth, SideEffect) ->
      {ok, {AnnAST, Info}} = refac_util:parse_annotate_file(FileName,true, [],TabWidth),  
      {ok, ModName} = get_module_name(Info),
      Forms = refac_syntax:form_list_elements(AnnAST),
      Exp1 = make_actual_parameter(ModName, Exp, SideEffect),
      F = fun(Form) ->
  		case refac_syntax:type(Form) of 
  		    function -> case get_fun_def_loc(Form) of 
  				    DefPos -> 
  					NewPar= refac_syntax:variable(ParName),
  					Cs = refac_syntax:function_clauses(Form),
  					Cs1 = [replace_clause_body(C, FunName, Arity, Exp, Exp1, Info) || C <-Cs],
  					Form1 = refac_syntax:copy_attrs(Form, refac_syntax:function(refac_syntax:atom(FunName), Cs1)),
  					ClauseToGen = hd(lists:filter(fun(C) -> {EStart, EEnd} = refac_util:get_range(Exp),
  										{CStart, CEnd} = refac_util:get_range(C),
  										(CStart =< EStart) andalso (EEnd =< CEnd)
  								      end, Cs)),
  					ClauseToGen1 =add_actual_parameter(replace_exp_with_var(ClauseToGen, {ParName, Exp, SideEffect}),
  									   {FunName, Arity , NewPar, Info}),
  					ClauseToGen2 = add_parameter(ClauseToGen1, NewPar),
  					NewForm = refac_syntax:function(refac_syntax:atom(FunName), [ClauseToGen2]),
  					[Form1, NewForm];
  				    _ -> [add_actual_parameter(Form, {FunName, Arity, Exp1, Info})]
  				end;
  		    _ -> [Form] 
  		end
  	end,		
      AnnAST1 =refac_syntax:form_list([T|| Form<-Forms, T <- F(Form)]),
      refac_util:write_refactored_files_for_preview([{{FileName,FileName}, AnnAST1}]),
      {ok, [FileName]}.
  
  replace_clause_body(C, FunName, Arity,Exp, Exp1, Info) ->
      {EStart, EEnd} = refac_util:get_range(Exp),
      {CStart, CEnd} = refac_util:get_range(C),
      case (CStart =< EStart) andalso (EEnd =< CEnd) of
  	true ->
  	    Pats = refac_syntax:clause_patterns(C),
  	    G = refac_syntax:clause_guard(C),
  	    Body = [refac_syntax:application(refac_syntax:atom(FunName), Pats++[Exp1])],
  	    refac_syntax:copy_attrs(C, refac_syntax:clause(Pats, G, Body));
  	_ -> add_actual_parameter(C, {FunName, Arity, Exp1, Info})
      end.
  	
      
  replace_exp_with_var(Tree, {ParName, Exp, SideEffect}) ->
      {Tree1, _} =refac_util:stop_tdTP(fun do_replace_exp_with_var/2, Tree, {ParName, Exp, SideEffect}),
      Tree1.
  