anchor.diff:  %%  This call is used if we are the initiator of a torrent handshake as
   %%  we then know the peer_id completely.
   %%--------------------------------------------------------------------
  -initiate_handshake(Socket, PeerId, MyPeerId, InfoHash) ->
  -    PSSize = length(?PROTOCOL_STRING),
  -    BinPeerId = list_to_binary(PeerId),
  +initiate_handshake(Socket, RemotePeerId, LocalPeerId, InfoHash) ->
  +    BinPeerId = list_to_binary(RemotePeerId),
       % Since we are the initiator, send out this handshake
  -    Header = <<PSSize:8, ?PROTOCOL_STRING, ?RESERVED_BYTES>>,
  +    Header = build_peer_protocol_header(),
       ok = gen_tcp:send(Socket, Header),
  -    ok = gen_tcp:send(Socket, InfoHash),
  -    ok = gen_tcp:send(Socket, MyPeerId),
  +    complete_handshake_header(Socket, InfoHash, LocalPeerId),
       % Now, we wait for his handshake to arrive on the socket
       % Since we are the initiator, he is requested to fire off everything
       % to us.
  -    case gen_tcp:recv(Socket, ?HANDSHAKE_SIZE, ?DEFAULT_HANDSHAKE_TIMEOUT) of
  -	{ok, Packet} ->
  -	    <<PSL:8/integer, ?PROTOCOL_STRING, ReservedBytes:8/binary,
  -	      IH:20/binary, PI:20/binary>> = Packet,
  +    case recieve_header(Socket) of
  +	{ok, ReservedBytes, IH, PI} ->
   	    if
  -		PSL /= PSSize ->
  -		    {error, packet_size_mismatch};
   		IH /= InfoHash ->
   		    {error, infohash_mismatch};
   		PI /= BinPeerId ->
  
positive.code: %%====================================================================
  %% Internal functions
  %%====================================================================
  
  %%--------------------------------------------------------------------
  %% Function: construct_bitfield
  
negative.code: %% API
  %%====================================================================
  %%--------------------------------------------------------------------
  %% Function: recv_message(Message) -> keep_alive | choke | unchoke |
  %%   interested | not_interested | {have, integer()} | ...
  %% Description: Receive a message from a peer and decode it
  %%--------------------------------------------------------------------
  recv_message(Message) ->
  