done with rewriting unions, except case 6 and 7 of fig 7