made code work, and union hack