More refactoring for code generation of encoding.