anchor.diff:              set_slave_key_value(Nodes, Key, Value),
               key_master(Nodes);
           { slave_connect, Pid } ->
  -            io:format('slave ~s connected~n', [io_lib:write(Pid)]),
  -            key_master([ Pid | Nodes ]);
  +            key_master(slave_connected(Nodes, Pid));
           { Pid, list_slaves } ->
               Pid ! { list_slaves, Nodes },
  -            key_master(Nodes)
  +            key_master(Nodes);
  +        {'DOWN', _Ref, process, DownPid, Reason} ->
  +            key_master(down_slave(Nodes, DownPid, Reason))
       end.
  +
  +down_slave(Nodes, DownPid, Reason) ->
  +    io:format("slaves ~s down for reason ~s~n", [io_lib:write(DownPid), Reason]),
  +    lists:delete(DownPid, Nodes).
  +
   
   set_slave_key_value([], _Key, _Value) ->
       ok;
  
positive.code: 	Pid = spawn(?MODULE, key_master, [[]]),
  	register(distkt, Pid).
  
  key_master([]) ->
      % No slaves are connected
      receive
  
negative.code:             Pid ! { error, noslaves },
              key_master([]);
          { slave_connect, Pid } ->
              key_master(slave_connected([], Pid));
          { Pid, list_slaves } ->
              Pid ! { list_slaves, [] },
              key_master([])
  