Move encode/decode to hideout module