anchor.diff:  %%% Internal functions
   %%--------------------------------------------------------------------
   
  +select_optimistic_unchoker(DoNotTouchPids, S) ->
  +    Size = dict:size(S#state.peer_process_dict),
  +    List = dict:to_list(S#state.peer_process_dict),
  +    % Guard such that we don't enter an infinite loop.
  +    %   There are multiple optimizations possible here...
  +    case sets:size(DoNotTouchPids) >= Size of
  +	true ->
  +	    S;
  +	false ->
  +	    select_optimistic_unchoker(Size, List, DoNotTouchPids, S)
  +    end.
  +
  +select_optimistic_unchoker(Size, List, DoNotTouchPids, S) ->
  +    N = crypto:rand_uniform(1, Size+1),
  +    {Pid, _PI} = lists:nth(N, List),
  +    case sets:is_element(Pid, DoNotTouchPids) of
  +	true ->
  +	    select_optimistic_unchoker(Size, List, DoNotTouchPids, S);
  +	false ->
  +	    NS = peer_dict_update(Pid,
  +				  fun(_K, PI) ->
  +					  PI#peer_info{optimistic_unchoke =
  +						       true}
  +				  end,
  +				  S),
  +	    torrent_peer:unchoke(Pid),
  +	    NS
  +    end.
  +
  +
   %%--------------------------------------------------------------------
   %% Function: perform_choking_unchoking(state()) -> state()
   %% Description: Peform choking and unchoking of peers according to the
  
positive.code:     Interested    = find_interested_peers(S#state.peer_process_dict),
  
      % N fastest interesteds should be kept
      {FastestInterested, Rest} =
  	find_fastest_peers(?DEFAULT_NUM_DOWNLOADERS,
  			   Interested),
      unchoke_peers(dict:fetch_keys(FastestInterested)),
  
      % All peers not interested should be unchoked
      unchoke_peers(dict:fetch_keys(NotInterested)),
  
negative.code:     D = dict:update(Pid, F, S#state.peer_process_dict),
      S#state{peer_process_dict = D}.
  
  peer_dict_map(F, S) ->
      D = dict:map(F, S#state.peer_process_dict),
      S#state{peer_process_dict = D}.
  
  usort_peers(IPList, S) ->
      NewList = lists:usort(IPList ++ S#state.available_peers),
  