Tried rewriting Decoder to be more legible and more obviously correct.
The number of bytes used to represent the various fields must be a nonzero integer.
Changed names of constants to be more descriptive.