beefing up encoding, adding decoding