Limited key tag to 7 bits.
Separated decoding into a static method.

Purely aesthetic change to create a static method pair for encoding & decoding.
Renamed encoding methods to something more sensible.