anchor.diff:  	    not_found
       end.
   
  -proplistify_tmap(#tracking_map { id = Id, filename = FN, supervisor_pid = SPid,
  -				 info_hash = IH, state = S }) ->
  -    [proplists:property(K,V) || {K, V} <- [{id, Id}, {filename, FN}, {supervisor, SPid},
  -					   {info_hash, IH}, {state, S}]].
  -
  -% @doc Map a {PathId, TorrentId} pair to a Path (string()).
  -% @end
  +%% @doc Map a {PathId, TorrentId} pair to a Path (string()).
  +%% @end
   -spec get_path(integer(), integer()) -> {ok, string()}.
   get_path(Id, TorrentId) when is_integer(Id) ->
       Pth = ets:lookup_element(path_map, {Id, TorrentId}, #path_map.path),
       {ok, Pth}.
   
  -% @doc Attempt to mark the torrent for checking.
  -%  <p>If this succeeds, returns true, else false</p>
  -% @end
  +%% @doc Attempt to mark the torrent for checking.
  +%%  <p>If this succeeds, returns true, else false</p>
  +%% @end
   -spec acquire_check_token(integer()) -> boolean().
   acquire_check_token(Id) ->
       gen_server:call(?MODULE, {acquire_check_token, Id}).
   
  -% @doc Populate the #path_map table with entries. Return the Id
  -% <p>If the path-map entry is already there, its Id is returned straight
  -% away.</p>
  -% @end
  +%% @doc Populate the #path_map table with entries. Return the Id
  +%% <p>If the path-map entry is already there, its Id is returned straight
  +%% away.</p>
  +%% @end
   -spec insert_path(string(), integer()) -> {value, integer()}.
   insert_path(Path, TorrentId) ->
       case ets:match(path_map, #path_map { id = {'$1', '_'}, path = Path}) of
  
positive.code: 	[PR] -> {peer_info, PR#peer.state, PR#peer.torrent_id}
      end.
  
  % @doc Return all peer pids with a given torrentId
  % @end
  % @todo We can probably fetch this from the supervisor tree. There is
  % less reason to have this then.
  -spec all_peer_pids(integer()) -> {value, [pid()]}.
  all_peer_pids(Id) ->
      R = ets:match(peers, #peer { torrent_id = Id, pid = '$1', _ = '_' }),
      {value, [Pid || [Pid] <- R]}.
  
  % @doc Change the peer to a seeder
  % @end
  -spec statechange_peer(pid(), seeder) -> ok.
  statechange_peer(Pid, seeder) ->
      [Peer] = ets:lookup(peers, Pid),
      true = ets:insert(peers, Peer#peer { state = seeding }),
      ok.
  
  % @doc Insert a row for the peer
  % @end
  -spec new_peer(ip(), integer(), integer(), pid(), seeding | leeching) -> ok.
  new_peer(IP, Port, TorrentId, Pid, State) ->
      true = ets:insert(peers, #peer { pid = Pid, ip = IP, port = Port,
  				     torrent_id = TorrentId, state = State}),
      add_monitor(peer, Pid).
  
  % @doc Add a new torrent
  % <p>The torrent is given by File with the Supervisor pid as given to the
  % database structure.</p>
  % @end
  -spec new_torrent(string(), pid(), integer()) -> ok.
  new_torrent(File, Supervisor, Id) when is_integer(Id), is_pid(Supervisor), is_list(File) ->
      add_monitor({torrent, Id}, Supervisor),
  
negative.code: 	L when is_list(L) -> true
      end.
  
  %% @doc Invoke a function on all peers matching a torrent Id
  %% @end
  -spec foreach_peer(integer(), fun((pid()) -> term())) -> ok.
  foreach_peer(Id, F) ->
      {value, Pids} = all_peer_pids(Id),
  