anchor.diff:    end,
     From ! {bee_terminated, Backend}.
   
  -% turn the command string from the comand string with the values
  -% of [[KEY]] replaced by the corresponding proplist element of
  -% the format:
  -%   {[[PORT]], "80"}
  -template_command_string(OriginalCommand, []) -> OriginalCommand;
  -template_command_string(OriginalCommand, [{Str, Replace}|T]) ->
  -  NewCommand = string_utils:gsub(OriginalCommand, Str, Replace),
  -  template_command_string(NewCommand, T).
  -
   % Handle pid exiting
  -handle_pid_exit(Pid, #state{current_bees = CurrBackends, available_ports = AvailablePorts} = State) ->
  +handle_pid_exit(Pid, _Code, #state{current_bees = CurrBackends, available_ports = AvailablePorts} = State) ->
     case find_pid_in_pid_table(Pid) of
       false -> 
         State;
  
positive.code:   ?LOG(info, "App ~p", [App]),
    
    TemplateCommand = App#app.start_command,  
    RealCmd = template_command_string(TemplateCommand, [
                                                          {"[[PORT]]", misc_utils:to_list(Port)},
                                                          {"[[GROUP]]", App#app.group},
                                                          {"[[USER]]", App#app.user}
                                                        ]),
    % START INSTANCE
    % port_handler:start("thin -R beehive.ru --port 5000 start", "/Users/auser/Development/erlang/mine/router/test/fixtures/apps").
    ?LOG(info, "Starting on port ~p as ~p:~p with ~p", [Port, App#app.group, App#app.user, RealCmd]),
    process_flag(trap_exit, true),
    Pid = port_handler:start(RealCmd, App#app.path, self()),
    Host = host:myip(),
    Id = {App#app.name, Host, Port},
    
  
negative.code: -module (app_handler).
  -include ("beehive.hrl").
  -include ("common.hrl").
  -include ("git.hrl").
  -behaviour(gen_server).
  
  %% API
  