anchor.diff:  %% @end
   -spec unpack(binary(), ppspp_options:options()) -> message() | messages().
   unpack(Maybe_Messages, Swarm_Options) when is_binary(Maybe_Messages) ->
  -    {messages, unpack3(Maybe_Messages, [], Swarm_Options)}.
  +    unpack3(Maybe_Messages, [], Swarm_Options).
   
   %% @doc convert a list of messages into binary iolist for transmission.
   %% @end
   -spec pack(messages()) -> iolist().
  -pack({messages, Messages}) -> pack(Messages, []).
  +pack(Messages) -> pack(Messages, []).
   
   %% private
  --spec pack(list(message()), iolist()) -> iolist().
  +-spec pack(messages(), iolist()) -> iolist().
   %% Try to pack another valid message, peeling off and parsing
   %% recursively the remainder, accumulating valid (packed) messages.
   %% A failure anywhere in a message ultimately causes the entire iolist
  
positive.code: pack_message(_Message) -> <<>>.
  
  %% if the binary is empty, all messages were parsed successfully
  -spec unpack3(binary(), message() | list(message()), ppspp_options:options()) ->
      list(message()) | { message(), binary()}.
  unpack3( <<>>, Parsed_Messages, _) ->
      lists:reverse(Parsed_Messages);
  %% otherwise try to unpack another valid message, peeling off and parsing
  
negative.code:     ?DEBUG("message: parser got valid message type ~p~n", [Message_Type]),
      Message_Type.
  
  %% @doc dispatch messages to correct handler in received order
  %% @end
  -spec handle(messages(),
               ppspp_options:options(),
               ppspp_datagram:endpoint()) -> ok.
  handle([], _, _ ) -> ok;
  handle([Message | Messages], Swarm_Options, Endpoint) ->
      ok  = handle_message(Message, Swarm_Options, Endpoint),
      handle(Messages, Swarm_Options, Endpoint);
  handle(Messages, Swarm_Options, Endpoint) ->
      handle(Messages, Swarm_Options, Endpoint).
  
  %% @doc does the dirty work of routing each message.
  %% Options and Endpoint are required state for handling many message types.
  %% @end
  -spec handle_message(message(),
                       ppspp_options:options(),
                       ppspp_datagram:endpoint()) -> ok | {error, any()}.
  handle_message(#{handshake := Handshake}, _Swarm_Options, Endpoint) ->
      ppspp_handshake:handle(Handshake, Endpoint);
  handle_message(#{have := Have}, _Swarm_Options, _Endpoint) ->
      ppspp_have:handle(Have);
  
  handle_message(Message, Swarm_Options, Endpoint) ->
      ?DEBUG("~p: handler not yet implemented ~n~p~n~p~n~p~n",
             [?MODULE, Message, Swarm_Options, Endpoint]),
      %{error, ppspp_message_handler_not_yet_implemented}.
      ok.
  