completed encoding and decoding of message