Initial implementation of autogen encoding/decoding (see #112)