improved user code generation