changed encode/decode funcs to use more 'standard' Go types