get rid of unions and replace them with flags