anchor.diff:  
   %% Internal functions
   spawn_new_torrent(F, S) ->
  -    {ok, TorrentSup} =
  -	etorrent_t_pool_sup:add_torrent(F, S#state.local_peer_id),
  -    ets:insert(S#state.tracking_map, {F, TorrentSup}),
  -    erlang:monitor(process, TorrentSup).
  +    T = fun() ->
  +		{ok, TorrentSup} =
  +		    etorrent_t_pool_sup:add_torrent(F, S#state.local_peer_id),
  +		erlang:monitor(process, TorrentSup),
  +		mnesia:write(#tracking_map { filename = F, supervisor_pid = TorrentSup })
  +	end,
  +    mnesia:transaction(T).
   
  -%% Utility
  +stop_torrent(F, S) ->
  +    error_logger:info_msg("Stopping ~p~n", [F]),
  +    Query = qlc:q([T#tracking_map.filename || T <- mnesia:table(tracking_map),
  +					      T#tracking_map.filename == F]),
  +    case qlc:e(Query) of
  +	[F] ->
  +	    etorrent_t_pool_sup:stop_torrent(F);
  +	[] ->
  +	    % Already stopped, do nothing, silently ignore
  +	    ok
  +    end,
  +    {noreply, S}.
  +
  +delete_torrent_by_pid(Pid) ->
  +    F = fun() ->
  +		Query = qlc:q([T#tracking_map.filename || T <- mnesia:table(tracking_map),
  +				    T#tracking_map.supervisor_pid == Pid]),
  +		lists:foreach(fun (F) -> mnesia:delete(tracking_map, F, write) end, qlc:e(Query))
  +	end,
  +    mnesia:transaction(F).
  +
   generate_peer_id() ->
       Number = crypto:rand_uniform(0, ?RANDOM_MAX_SIZE),
       Rand = io_lib:fwrite("~B----------", [Number]),
  
positive.code: -define(SERVER, ?MODULE).
  -define(RANDOM_MAX_SIZE, 1000000000).
  
  -record(state, { tracking_map,
  		 local_peer_id }).
  
  %% API
  
  
negative.code: 
  %% Callbacks
  init(_Args) ->
      {ok, #state { local_peer_id = generate_peer_id()}}.
  
  handle_cast({start_torrent, F}, S) ->
      spawn_new_torrent(F, S),
      {noreply, S};
  handle_cast({stop_torrent, F}, S) ->
      stop_torrent(F, S),
      {noreply, S}.
  
  
  handle_call(_A, _B, S) ->
      {noreply, S}.
  
  handle_info({'DOWN', _R, process, Pid, _Reason}, S) ->
      error_logger:info_msg("Got Down Msg ~p~n", [Pid]),
      delete_torrent_by_pid(Pid),
      {noreply, S};
  handle_info(Info, State) ->
      error_logger:info_msg("Unknown message: ~p~n", [Info]),
  