   @moduledoc false
 
   require Integer
+
   import MarcoPolo.Protocol.BinaryHelpers
+
+  alias MarcoPolo.GenericParser, as: GP
   alias MarcoPolo.Error
-  alias MarcoPolo.GenericParser
   alias MarcoPolo.Protocol.RecordSerialization
 
   @type encodable_term ::

  end

  defp parse_resp_contenst(:connect, data) do
    GenericParser.parse(data, [&parse(&1, :int), &parse(&1, :bytes)])
  end

  defp parse_resp_contents(:db_open, data) do
    parsers = [
      &parse(&1, :int),   # sid
      &parse(&1, :bytes), # token
      GenericParser.array_parser(
        &parse(&1, :short),                       # number of clusters
        [&parse(&1, :string), &parse(&1, :short)] # cluster name + cluster id
      ),

  end

  defp parse_resp_to_command(<<type, data :: binary>>) when type in [@list, @set] do
    parsers = [GP.array_parser(&parse(&1, :int), &parse_record_with_rid/1), &parse(&1, :byte)]

    case GP.parse(data, parsers) do
      # TODO find out why OrientDB shoves a 0 byte at the end of this list, not
      # mentioned in the docs :(
      {[records, 0], rest} -> {records, rest}
