anchor.diff:                      From !{get_next_command, Parent, [ok, []]}
               end;
           {'EXIT', ChildrenPid, Reason} ->
  -            refac_io:format("~p died with:~p~n", [ChildrenPid, Reason]),
  +            wrangler_io:format("~p died with:~p~n", [ChildrenPid, Reason]),
               if_then_refac_loop(Parent, State);
           Msg ->
               error(format_msg("Unexpected message in if_then_refac_loop:~p\n", Msg))  
  
positive.code:                     case ERs of
                          [{refactoring, Refac, Question}|Cs] ->
                              NewState=update_state(State, PrevResult),
                              From ! {self(), {ok, {question, Question, Refac}}, self()},
                              question_refac_loop(Parent, NewState#state{cmds={question, Cs}});
                          [] ->
                              ModifiedSoFar =update_modified_files(PrevResult,Changes),
                              From ! {get_next_command, Parent, [ok, sets:to_list(ModifiedSoFar)]}
                      end
              end;
          {'EXIT', ChildrenPid, Reason} ->
              refac_io:format("~p died with:~p~n", [ChildrenPid, Reason]),
              cmd_server_loop(Parent, State);
          Msg ->
              refac_io:format("Unexpected message in question_refac_loop: ~p.\n", [Msg]),
              error(format_msg("Unexpected message in question_refac_loop: ~p.\n", Msg))
      end.
  
  repeat_question_refac_loop(Parent, State=#state{cmds={question, ER0s},changed_files=Changes}) ->
      receive 
          {From, get_next_command, PrevResult} ->
              ERs = generate_cmds(ER0s,State#state.name_tracker_pid),
              case ERs of
                  [{refactoring, Refac, Question}|_Cs] ->
                      case PrevResult of
                          none ->
                              From ! {get_next_command, Parent, [ok, Changes]};
                          [ok, _Modified] ->
                              NewState=update_state(State, PrevResult),
                              From ! {self(), {ok, {repeat_question, Question, Refac}}, self()},
                              repeat_question_refac_loop(Parent, NewState#state{cmds=ERs});
                          [error, _Reason] ->
                              Parent! {get_next_command, Parent, PrevResult}
                      end;
                  [] ->
                      From ! {get_next_command, Parent, [ok, Changes]}
              end;
          {'EXIT', ChildrenPid, Reason} ->
              refac_io:format("~p died with:~p~n", [ChildrenPid, Reason]),
              cmd_server_loop(Parent, State);
          Msg ->
              refac_io:format("Unexpected message in repeat_question_refac_loop: ~p.\n", [Msg]),
              error(format_msg("Unexpected message in repeat_question_refac_loop: ~p.\n", Msg))
      end.
  
  while_refac_loop(Parent, State=#state{cmds={while, Cond, CRs}, 
                                        changed_files=Changes}) ->
      receive
      {From, get_next_command, _PrevResult} ->
          case Cond() of
              true ->
                  CurrentPid = self(),
                  CR1s = make_list(CRs),
                  Pid = spawn_link(fun()->
                                           cmd_server_loop(CurrentPid, State#state{cmds=CR1s})
                                   end),
                  process_flag(trap_exit, true),
                  From ! {get_next_command, Pid, [ok, []]},
                  while_refac_loop(Parent, State);
              false ->
                  From !{get_next_command, Parent, [ok, Changes]}
          end;
          {'EXIT', ChildrenPid, Reason} ->
              refac_io:format("~p died with:~p~n", [ChildrenPid, Reason]),
              while_refac_loop(Parent, State);
          Msg ->
              error(format_msg("Unexpected message in while_refac_loop:~p\n", Msg))    
  
negative.code:             process_flag(trap_exit, true),
              From ! {get_next_command, Pid, [ok, []]};
          {'EXIT', ChildrenPid, Reason} ->
              wrangler_io:format("~p died with:~p~n", [ChildrenPid, Reason]),
              if_then_else_refac_loop(Parent, State);
          Msg ->
              error(format_msg("Unexpected message in if_then_else_refac_loop:~p\n", Msg))  
      end.  
  
  %% not really a loop.
  if_then_refac_loop(Parent, State=#state{cmds={if_then, Cond, CRs}}) ->
      receive
  