anchor.diff:        Some(date)
       else None
   
  -  let (|OpenGroup|String|Uint|Int|Float|Bool|) inp =
  -    match inp with
  -    | 0x000cs -> Uint(stream.ReadUInt32())
  -    | 0x0014s -> Int(stream.ReadInt32())
  -    | 0x000es -> Bool(stream.ReadByte() <> 0uy)
  -    | 0x000fs | 0x0017s -> String(readString())
  -    | 0x000ds -> Float(stream.ReadSingle())
  -    | 0x0003s -> OpenGroup()
  -    | x -> failwith "Unrecognized type"
  -
  -  let parseKey token =
  +  let parseToken token =
       match token with
  -    | 0x000fs | 0x0017s -> readString()
  -    | x -> lookupId x
  +    | 0x000cs -> BinaryToken.Uint(stream.ReadUInt32())
  +    | 0x0014s -> BinaryToken.Int(stream.ReadInt32())
  +    | 0x000es -> BinaryToken.Bool(stream.ReadByte() <> 0uy)
  +    | 0x000fs | 0x0017s -> BinaryToken.String(readString())
  +    | 0x000ds -> BinaryToken.Float(stream.ReadSingle())
  +    | 0x0003s -> BinaryToken.OpenGroup
  +    | 0x0004s -> BinaryToken.EndGroup
  +    | 0x0001s -> BinaryToken.Equals
  +    | x -> BinaryToken.Token(lookupId x)
  +
  +  let endGroup = function | BinaryToken.EndGroup -> true | _ -> false
  +  let ensureEquals =
  +    function
  +    | BinaryToken.Equals -> ()
  +    | x -> failwithf "Expected equals, but got: %s" (x.ToString())
  +
  +  let ensureIdentifier =
  +    function
  +    | BinaryToken.String(x) -> x
  +    | BinaryToken.Token(x) -> x
  +    | x -> failwithf "Expected identifier, but got %s" (x.ToString())
  +
  +  let nextToken () = tok <- parseToken (stream.ReadInt16()); tok
   
     let rec parseTopObject () =
       let pairs = ResizeArray<_>()
       while stream.BaseStream.Position <> stream.BaseStream.Length do
  -      let key = parseKey (stream.ReadInt16())
  -      tok <- stream.ReadInt16()
  -      if tok <> 0x0001s then failwith "Expected equals token"
  -      tok <- stream.ReadInt16()
  +      let key = nextToken() |> ensureIdentifier
  +      nextToken() |> ensureEquals 
  +      nextToken() |> ignore
         pairs.Add((key, parseValue()))
       pairs.ToArray()
   
  
positive.code:       assert (stream.Peek() = 61)
        parseObject first (fun stream -> stream.EndOfStream)
  
  type private BinaryParaParser (stream:BinaryReader, lookup:IDictionary<int16, string>) =
  
    let mutable tok = 0s
    let readString () = String(stream.ReadChars(stream.ReadUInt16() |> int))
  
    /// Looks up the human friendly name for an id. If the name does not exist,
  
negative.code:     let pairs = ResizeArray<_>()
  
      // Advance reader to the next token
      nextToken() |> ignore
  
      pairs.Add((firstKey, parseValue()))
      nextToken() |> ignore
      
      while not (endGroup tok) do
        let key = tok |> ensureIdentifier
        nextToken() |> ensureEquals
        nextToken() |> ignore
        pairs.Add((key, parseValue()))
        nextToken() |> ignore
      pairs.ToArray()
  
    and parseArrayFirst first =
      let values = ResizeArray<_>()
      values.Add(first)
      parseArray(values)
  
    and parseArray (values:ResizeArray<_>) =
      while not (endGroup tok) do
        values.Add(parseValue())
        nextToken() |> ignore
      values.ToArray()
  
    and parseValue () =
      match tok with
      | BinaryToken.Uint(x) ->
        match x with
        | HiddenDate(date) -> ParaValue.Date(date)
        | num -> ParaValue.Number(float(num))
      | BinaryToken.Int(x) -> ParaValue.Number(float(x))
      | BinaryToken.Bool(b) -> ParaValue.Bool(b)
      | BinaryToken.String(s) -> ParaValue.String(s)
      | BinaryToken.Float(f) -> ParaValue.Number(float(f))
      | BinaryToken.OpenGroup -> parseSubgroup()
      | x -> failwithf "Unexpected token %s" (x.ToString())
  
    and parseSubgroup () =
      match (nextToken()) with
      | BinaryToken.Int(x) ->
        nextToken() |> ignore
        ParaValue.Array(parseArrayFirst (ParaValue.Number(float(x))))
      | BinaryToken.Uint(x) ->
        nextToken() |> ignore
        ParaValue.Array(parseArrayFirst (ParaValue.Number(float(x))))
      | BinaryToken.String(x) -> stringSubgroup()
      | BinaryToken.OpenGroup ->
        let firstKey = nextToken() |> ensureIdentifier
        nextToken() |> ensureEquals
        let first = ParaValue.Record(parseObject firstKey)
        nextToken() |> ignore
        ParaValue.Array(parseArrayFirst first)
      | BinaryToken.Token(x) ->
        nextToken() |> ensureEquals
        ParaValue.Record(parseObject x)
      | x -> failwithf "Unexpected token %s" (x.ToString())    
  
    and stringSubgroup () =
      match (nextToken()) with
      | BinaryToken.Equals -> ParaValue.Record(parseObject x)
      | BinaryToken.String(s) ->
        let values = ResizeArray<_>()
        values.Add(ParaValue.String x)
        values.Add(ParaValue.String s)
        nextToken() |> ignore
        ParaValue.Array(parseArray values)
      | BinaryToken.EndGroup -> ParaValue.Array([| ParaValue.String(x) |])
      | x -> failwithf "Unexpected token: %s" (x.ToString())
  
    member x.Parse (header:option<string>) =
      match header with
  