Update encode/decode functions