anchor.diff:  
   %% API
   -export([new_torrent/3, cleanup_torrent_by_pid/1,
  -	 store_torrent/2, set_torrent_state/2, select_torrent/2,
  +	 store_torrent/2, set_torrent_state/2,
   	 select_torrent/1, delete_torrent/1, delete_torrent_by_pid/1,
   	 store_peer/4, select_peer_ip_port_by_pid/1, delete_peer/1,
   	 peer_statechange/2, is_peer_connected/3, select_interested_peers/1,
  
positive.code:     mnesia:transaction(F).
  
  %%--------------------------------------------------------------------
  %% Function: select_torrent(InfoHash, Pid) -> Rows
  %% Description: Return rows matching infohash and pid
  %%--------------------------------------------------------------------
  select_torrent(InfoHash, Pid) ->
      Q = qlc:q([IH || IH <- mnesia:table(torrent),
  		     IH#torrent.info_hash =:= InfoHash,
  		     IH#torrent.storer_pid =:= Pid]),
      qlc:e(Q).
  
  %%--------------------------------------------------------------------
  %% Function: select_torrent(Id) -> Pids
  %%   Id = infohash() | pid()
  %% Description: Return all rows matching infohash
  %%--------------------------------------------------------------------
  select_torrent(Pid) when is_pid(Pid) ->
      mnesia:transaction(
        fun () ->
  	      error_logger:info_report(selecting_by_pid),
  	      Q = qlc:q([IH || IH <- mnesia:table(torrent),
  			       IH#torrent.storer_pid =:= Pid]),
  	      qlc:e(Q)
        end);
  select_torrent(InfoHash) when is_binary(InfoHash) ->
      mnesia:transaction(
        fun () ->
  	      error_logger:info_report(selecting_by_hash),
  	      mnesia:read(torrent, InfoHash, read)
        end).
  
  %%--------------------------------------------------------------------
  %% Function: delete_torrent(InfoHash) -> transaction
  
negative.code: %% Description: Set the state of an info hash.
  %%--------------------------------------------------------------------
  set_torrent_state(Id, S) when is_integer(Id) ->
      F = fun() ->
  		case mnesia:read(torrent, Id, write) of
  		    [T] ->
  			New = case S of
  				  unknown ->
  				      T#torrent{state = unknown};
  				  leeching ->
  