Various improvements to union codegen.