anchor.diff:  
   
   %% @doc
  -%%
  +%% Insert a new piece with an initial number of providing peers into the
  +%% scarcity list. The piece index must be larger than or equal to zero.
  +%% It is up the calling process to check that the piece index is not higher
  +%% than the number of pieces in the torrent.
   %% @end
   -spec insert(pos_integer(), pos_integer(), #scarcity{}) -> scarcity().
   insert(Index, Count, Scarcity) ->
       #scarcity{counters=Counters, ordering=Ordering} = Scarcity,
       assert_not_member(Index, Counters),
  +    assert_positive(Count),
   
       NewCounters = array:set(Index, Count, Counters),
       NewOrdering = gb_sets:insert({Count, Index}, Ordering),
   
       #scarcity{counters=NewCounters, ordering=NewOrdering}.
   
  -%% @doc
  -%%
  +
  +%% @doc
  +%% Delete a piece from the scarcify. The piece must be a member of
  +%% the scarcity list or the function will throw error(badarg).
   %% @end
   -spec delete(pos_integer(), #scarcity{}) -> scarcity().
   delete(Index, Scarcity) ->
  
positive.code:     #scarcity{counters=Counters, ordering=Ordering} = Scarcity,
      assert_member(Index, Counters),
  
      Count = array:get(Index, Counters),
      NewCounters = array:set(Index, Count - 1, Counters),
      TmpOrdering = gb_sets:delete({Count, Index}, Ordering),
      NewOrdering = gb_sets:insert({Count - 1, Index}, TmpOrdering),
  
      #scarcity{counters=NewCounters, ordering=NewOrdering}.
  
  
negative.code: 
      #scarcity{counters=NewCounters, ordering=NewOrdering}.
  
  
  %% @doc
  %% Increment the number of peers providing a piece by one and
  %% reprioritize the pieces in the scarcity list.
  %% @end
  -spec increment(pos_integer(), #scarcity{}) -> scarcity().
  increment(Index, Scarcity) ->
      #scarcity{counters=Counters, ordering=Ordering} = Scarcity,
      assert_member(Index, Counters),
  
      Count    = array:get(Index, Counters),
      NewCount = Count + 1,
      NewCounters = array:set(Index, NewCount, Counters),
      TmpOrdering = gb_sets:delete({Count, Index}, Ordering),
      NewOrdering = gb_sets:insert({NewCount, Index}, TmpOrdering),
  
      #scarcity{counters=NewCounters, ordering=NewOrdering}.
  
  