Encoding cleanup