Added Encode and Decode
merged