anchor.diff:  		  end
   	  end,
       Forms0 = [Fun(F) || F <- Forms],
  -    refac_syntax:form_list(Forms0).
  -   
  +    Forms1 = unfold_conversion_apps(Forms0, RecordToTupleFunName, TupleToRecordFunName, RecordName, RecordFields, IsTuple),    
  +    Forms2 = add_util_funs(Forms1, ModInfo, RecordName, RecordFields,TupleToRecordFunName, RecordToTupleFunName),
  +    case RecordExists of
  +      true ->
  +	  refac_syntax:form_list(Forms2);
  +      false ->
  +	  RecordDef = mk_record_attribute(RecordName, RecordFields),
  +	  NewForms =  insert_record_attribute(Forms2, RecordDef),
  +	  refac_syntax:form_list(NewForms)
  +    end.
  +
   do_state_to_record_1(ModName, Fun, RecordName, RecordFields, StateFuns, IsTuple, 
   		     SM, TupleToRecordFunName, RecordToTupleFunName) ->
       As = refac_syntax:get_ann(Fun),
  
positive.code:     wrap_fun_interface_in_return(Form1, ModName, RecordName, RecordFields, IsTuple, StateFuns, SM,
  				TupleToRecordFunName, RecordToTupleFunName).
  
  wrap_fun_interface_in_return(Form, ModName, RecordName, RecordFields, IsTuple, StateFuns, SM,
  			     TupleToRecordFunName, RecordToTupleFunName) ->
      Fun = fun (Node, _Others) ->
  		  case is_callback_fun_app(Node, ModName, StateFuns, SM) of
  		    {true, _PatIndex, true} ->
  			case SM of
  			  gen_fsm ->
  			      throw({error, "Callback functions are called as normal functions."});
  			  _ ->
  			      make_record_to_tuple_app(Node, RecordName, RecordFields, IsTuple,
  						       TupleToRecordFunName, RecordToTupleFunName)
  			end;
  		    false ->
  			Node
  		  end
  	  end,
      Form1 = refac_util:full_buTP(Fun, Form, {}),
      case SM of
        gen_fsm ->
  	  Form1;
        _ ->
  	  Res = check_use_of_run_commands(Form1, SM),
  	  case Res of
  	    [] -> Form1;
  	    _ ->
  		  UsedVarNames=ordsets:from_list(refac_misc:collect_var_names(Form1)),
  		  {Form2, _} = refac_util:stop_tdTP(fun wrap_run_commands_result/2, Form1,
  						    {RecordName, RecordFields, Res, IsTuple,
  						     UsedVarNames, SM}),
  		  Form2
  	  end
      end.
  
  check_use_of_run_commands(Form, SM) ->
  
negative.code: 
  transform_run_command(Node, UsedVars, RecordName, RecordFields, IsTuple, SM) ->
      Node1 = refac_util:reset_attrs(Node),
      H = refac_syntax:variable(refac_unfold_fun_app:make_new_name('H', UsedVars)),
      S = refac_syntax:variable(refac_unfold_fun_app:make_new_name('S', UsedVars)),
      Res = refac_syntax:variable(refac_unfold_fun_app:make_new_name('Res', UsedVars)),
      Es = [H, S, Res],
      Tuple = refac_syntax:tuple(Es),
      Expr1 = refac_syntax:match_expr(Tuple, Node1),
  