use encode/decode method