tests now pass - encoding and decoding both work.