worked on the encoding/decoding
fixed merge errors