anchor.diff:              pick_chunks(chunkify_piece, {Pid, Id, PieceSet, SoFar, Remaining, none});
           found_chunked ->
               pick_chunks(chunkify_piece, {Pid, Id, PieceSet, SoFar, Remaining, found_chunked});
  -	Selected when is_list(Selected) ->
  -	    {ok, {PieceNum, Chunks}, Size} =
  -                select_chunks_by_piecenum(Selected, Remaining, Pid),
  -            pick_chunks(pick_chunked, {Pid, Id,
  -                                       gb_sets:del_element(PieceNum, PieceSet),
  -                                       [{PieceNum, Chunks} | SoFar],
  -                                       Remaining - Size, Res})
  +	PN when is_integer(PN) ->
  +	    case select_chunks_by_piecenum({Id, PN}, Remaining) of
  +		{ok, {PieceNum, Chunks}, Size} ->
  +		    pick_chunks(pick_chunked, {Pid, Id,
  +					       gb_sets:del_element(PieceNum, PieceSet),
  +					       [{PieceNum, Chunks} | SoFar],
  +					       Remaining - Size, Res});
  +		{error, already_taken} ->
  +		    %% So somebody else took this, try again
  +		    pick_chunks(pick_chunked, {Pid, Id, PieceSet, SoFar, Remaining, Res})
  +	    end
       end;
   
   %%
  
positive.code: %%   the iterator for a pieces we have already chunked and are downloading.
  %%   If found, return the #chunk{} object. Otherwise return 'none'
  %% @end
  -spec find_chunked_chunks(pos_integer(), term(), A) -> A | [#chunk{}].
  find_chunked_chunks(_Id, none, Res) -> Res;
  find_chunked_chunks(Id, {Pn, Next}, Res) ->
      case etorrent_piece_mgr:is_chunked(Id, Pn) of
          true ->
              case ets:lookup(?TAB, {Id, Pn, not_fetched}) of
                  [] ->
                      find_chunked_chunks(Id, gb_sets:next(Next), found_chunked);
                  Objects ->
                      Objects
              end;
          false ->
              find_chunked_chunks(Id, gb_sets:next(Next), Res)
  
negative.code:     Shuffled = etorrent_utils:shuffle(Remaining),
      {endgame, lists:sublist(Shuffled, N)}.
  
  
  -spec pick_chunks_endgame(integer(), gb_set(), integer(), X) -> X | {endgame, [#chunk{}]}.
  pick_chunks_endgame(Id, Set, Remaining, Ret) ->
  