Slight changes to encoding and remove of extra decoding