anchor.diff:  	  end),
       Res.
   
  -%%--------------------------------------------------------------------
  -%% Function: retrieve_chunks(Id, PieceNum) -> {ok, Data}
  -%% Description: Return the Piece comprising of the chunks for it and
  -%%   clean them away from the mnesia tables.
  -%%--------------------------------------------------------------------
  -retrieve_chunks(Id, PieceNum) ->
  -    F = fun () ->
  -		[R] = mnesia:read(chunk, {Id, PieceNum, fetched},
  -				  write),
  -		mnesia:delete_object(R),
  -		R#chunk.chunks
  -	end,
  -    {atomic, Offsets} = mnesia:transaction(F),
  -    Chunks = read_delete_chunks(lists:usort(Offsets), Id, PieceNum),
  -    list_to_binary([Data || {_, Data} <- Chunks]).
  -
  -
   endgame_remove_chunk(Pid, Id, {Index, Offset, Len}) ->
       case mnesia:dirty_read(chunk, {Id, Index, {assigned, Pid}}) of
   	[] ->
  
positive.code: 
  %% API
  -export([pick_chunks/4, store_chunk/4, putback_chunks/1,
  	 endgame_remove_chunk/3, retrieve_chunks/2]).
  
  %%====================================================================
  %% API
  
negative.code: %%====================================================================
  %% Internal functions
  %%====================================================================
  
  %%--------------------------------------------------------------------
  %% Function: find_remaining_chunks(Id, PieceSet) -> [Chunk]
  