Added API functionality for encoding / decoding