   # Page
   defp decode_result_response(<<0x0002::32-signed>> <> buffer, query) do
     page = new_page(query)
-    {page, buffer} = decode_metadata(page, buffer)
+    {page, buffer} = decode_metadata(buffer, page)
     content = decode_page_content(buffer, page.columns)
     %{page | content: content}
   end

  # TODO: UDT

  defp decode_type(<<0x0031::16, count::16>> <> buffer) do
    decode_type_tuple(count, buffer, [])
  end

  defp decode_type_tuple(0, buffer, acc) do
    {{:tuple, Enum.reverse(acc)}, buffer}
  end

  defp decode_type_tuple(count, buffer, acc) do
    {type, buffer} = decode_type(buffer)
    decode_type_tuple(count - 1, buffer, [type | acc])
  end

  defp decode_string_multimap(<<size::16>> <> buffer) do

    %{keyspace: keyspace, subject: subject}
  end

  defp decode_metadata(<<flags::4-bytes, column_count::32-signed>> <> buffer, page) do
    <<_::29, no_metadata::1, has_more_pages::1, global_table_spec::1>> = flags
    {page, buffer} = decode_paging_state(buffer, page, has_more_pages)

    cond do
      no_metadata == 1 ->
