clean up enc/dec functions