Added simpler encoding and decoding interface.