Encoding/decoding complete - TODO: safety checking in enc/dec functions then -> emulation