optimize unions