working decoder that can handle D3 and D4 examples from draft