Added variables for encode/decode options to avoid mutating the base object.
Added encoding tests