anchor.diff:              end
       end.
   
  +%% Gather information about each Peer so we can choose which peers to
  +%%  bet on for great download/upload speeds. Produces a #rechoke_info{}
  +%%  list out of peers containing all information necessary for the choice.
  +-spec build_rechoke_info(set(), [pid()]) -> [#rechoke_info{}].
   build_rechoke_info(_Seeding, []) -> [];
   build_rechoke_info(Seeding, [Pid | Next]) ->
       case etorrent_table:get_peer_info(Pid) of
           not_found -> build_rechoke_info(Seeding, Next);
  -        {peer_info, Kind, Id} ->
  -            {value, Snubbed, PeerState} = etorrent_rate_mgr:get_state(Id, Pid),
  +        {peer_info, PeerState, Id} ->
  +            {value, Snubbed, St} = etorrent_rate_mgr:get_state(Id, Pid),
               case lookup_info(Seeding, Id, Pid) of
                   none -> build_rechoke_info(Seeding, Next);
  -                {S, R} -> [#rechoke_info {
  +                {State, R} -> [#rechoke_info {
                                       pid = Pid,
  -                                    kind = Kind,
  -                                    state = S,
  -                                    rate = R,
  -                                    r_interest_state = proplists:get_value(interest_state, PeerState),
  -                                    r_choke_state    = proplists:get_value(choke_state, PeerState),
  -                                    l_choke          = proplists:get_value(local_choke, PeerState),
  +                                    peer_state = PeerState,
  +                                    state = State,
  +                                    rate = R, % TODO: Rate is negative if leeching! Investigate!
  +                                    r_interest_state = proplists:get_value(interest_state, St),
  +                                    r_choke_state    = proplists:get_value(choke_state, St),
  +                                    l_choke          = proplists:get_value(local_choke, St),
                                       snubbed = Snubbed } |
                               build_rechoke_info(Seeding, Next)]
               end
  
positive.code:             end
      end.
  
  split_preferred_peers([], Downs, Leechs) ->
      {Downs, Leechs};
  split_preferred_peers([P | Next], Downs, Leechs) ->
      case P#rechoke_info.kind =:= seeding
            orelse P#rechoke_info.r_interest_state =:= not_interested of
          true ->
              split_preferred_peers(Next, Downs, Leechs);
          false when P#rechoke_info.state =:= seeding ->
              split_preferred_peers(Next, Downs, [P | Leechs]);
          false when P#rechoke_info.snubbed =:= true ->
              split_preferred_peers(Next, Downs, Leechs);
          false ->
              split_preferred_peers(Next, [P | Downs], Leechs)
      end.
  
  %%====================================================================
  
negative.code:                 opt_unchoke_chain = []}).
  
  -record(rechoke_info, {pid :: pid(),
                         peer_state :: 'seeding' | 'leeching', % Is the peer seeding or leeching
                         state :: 'seeding' | 'leeching' , % Are we seeding or leeching the torrent of the peer
                         snubbed :: boolean(),
                         r_interest_state :: 'interested' | 'not_interested',
                         r_choke_state :: 'choked' | 'unchoked' ,
  