cosmetics: Move functions around so that encoding and decoding functions are