Fix bug in decode.
Implement encode.
Verify decode.