[Generator] Improve source code structure and maintainability.