working on decoding/encoding