Finished encoding and decoding functionality.