anchor.diff:  
                    remote_request_set = gb_sets:empty() :: gb_set(),
   
  -                 piece_set = unknown :: unknown | pieceset(),
  +                 %% Keep two piecesets, the set of pieces that we have
  +                 %% validated, and the set of pieces that the peer has.
  +                 remote_pieces = unkown :: pieceset(),
  +                 local_pieces  = unkown :: pieceset(),
  +
                    piece_request = [],
   
   		 %% Are we in endgame mode?
  
positive.code:                 ok ->
                      case etorrent_piece_mgr:interesting(S#state.torrent_id, PN) of
                          true ->
                              PS = etorrent_pieceset:insert(PN, S#state.piece_set),
                              NS = S#state{piece_set=PS, pieces_left=Left, seeder= Left == 0},
                              case S#state.local_interested of
                                  true ->
                                      try_to_queue_up_pieces(NS);
  
negative.code: handle_message({suggest, Idx}, S) ->
      ?INFO([{peer_id, S#state.remote_peer_id}, {suggest, Idx}]),
      {ok, S};
  handle_message(have_none, #state{remote_pieces=PS}=S) when PS =/= unknown ->
      {stop, normal, S};
  handle_message(have_none, #state{fast_extension=true, torrent_id=TorrentID}=S) ->
      {value, NumPieces} = etorrent_torrent:num_pieces(TorrentID),
      Pieceset = etorrent_pieceset:new(NumPieces),
      NewState = S#state{
          remote_pieces=Pieceset,
          pieces_left=NumPieces,
          seeder=false},
      {ok, NewState};
  
  handle_message(have_all, #state{remote_pieces=PS}) when PS =/= unknown ->
      {error, remote_pieces_out_of_band};
  
  handle_message(have_all, #state{fast_extension=true, torrent_id=TorrentID}=S) ->
      {value, NumPieces} = etorrent_torrent:num_pieces(TorrentID),
      AllPieces = lists:seq(0, NumPieces - 1),
      FullSet = etorrent_pieceset:from_list(AllPieces, NumPieces),
      NewState = S#state{
          remote_pieces=FullSet,
          pieces_left=0,
          seeder=true},
      {ok, NewState};
  
  handle_message({bitfield, _}, #state{remote_pieces=PS}=S) when PS =/= unknown ->
      #state{ socket=Socket, remote_peer_id=RemoteID} = S,
      {ok, {IP, Port}} = inet:peername(Socket),
      etorrent_peer_mgr:enter_bad_peer(IP, Port, RemoteID),
      {error, remote_pieces_out_of_band};
  
  handle_message({bitfield, Bin}, State) ->
      #state{
  