anchor.diff:      end || {N, IsValid} <- lists:sort(States)],
       ChunkSets = array:from_orddict(ChunkList),
   
  -    PiecesBegun = etorrent_pieceset:from_list([], NumPieces),
  -    PriorityBegun = init_priority(TorrentID, begun, PiecesBegun),
  -    PriorityUnass = init_priority(TorrentID, unassigned, PiecesInvalid),
  +    PiecePriority = init_priority(TorrentID, unassigned, PiecesInvalid),
   
       InitState = #state{
           torrent_id=TorrentID,
  
positive.code:             end;
          %% One or more that we are already downloading
          begun ->
              #pieceprio{pieces=BegunPriolist} = PrioBegun,
              etorrent_pieceset:first(BegunPriolist, Optimal);
          %% None that we are not already downloading
          %% but one ore more that we would want to download
          unassigned ->
              #pieceprio{pieces=UnassignedPriolist} = PrioUnassigned,
              etorrent_pieceset:first(UnassignedPriolist, SubOptimal)
      end,
  
  
negative.code:      %% Assigned -> Begun
       NewAssigned = etorrent_pieceset:delete(Piece, Assigned),
       NewBegun = etorrent_pieceset:insert(Piece, Begun),
   
       NewState = State#state{
           pieces_begun=NewBegun,
           pieces_assigned=NewAssigned,
           chunks_assigned=NewAssignedChunks},
      {noreply, NewState};
  
  
  handle_info({scarcity, Ref, Tag, Piecelist}, State) ->
      #state{piece_priority=PiecePriority} = State,
      %% Verify that the tag is valid before verifying the reference
      #pieceprio{ref=PrioRef} = PiecePriority,
      %% Verify that the reference belongs to the active subscription
      %% If not, drop the update and hope that it was a stray one.
      NewState = case Ref of
          PrioRef ->
              NewPriority = PiecePriority#pieceprio{pieces=Piecelist},
              State#state{piece_priority=NewPriority};
          _ ->
              State
      end,
  