split out enc/decode steps