Modify code generation and update docs