encode/decode cookie as separate methods