anchor.diff:  -record(state, {
     max_backends,             % maximum number of backends on this host
     available_ports,          % available ports on this node
  +  app_pids,                 % pids that are running the apps
     current_backends  = []    % backends hosted on this app_handler
   }).
   -define(SERVER, ?MODULE).
  
positive.code:   
    {ok, #state{
      max_backends = MaxBackends,
      available_ports = AvailablePorts
    }}.
  
  
negative.code: %%                                       {stop, Reason, State}
  %% Description: Handling all non call/cast messages
  %%--------------------------------------------------------------------
  handle_info({'EXIT', Pid, _Reason}, #state{
                                        app_pids = AppPids, 
                                        current_backends = CurrBackends, 
                                        available_ports = AvailablePorts} = State
                                      ) ->
    case lists:keymember(Pid, 1, AppPids) of
      true ->
        % This is an app port running
        {value, {Pid, Backend}} = lists:keysearch(Pid, 1, AppPids),
        NewAppPids = lists:keydelete(Pid, 1, AppPids),
        NewPorts = lists:delete(Backend#backend.port, AvailablePorts),
        NewBackends = lists:delete(Backend, CurrBackends),
        ?NOTIFY({backend, backend_down, Backend}),
        {noreply, State#state{app_pids = NewAppPids, available_ports = NewPorts, current_backends = NewBackends}};
      false ->
        {noreply, State}
    end;
  handle_info(Info, State) ->
    ?LOG(info, "~p caught info: ~p", [?MODULE, Info]),
    {noreply, State}.
  