almost implemented union; need to fix a performance bug caused by logic expression evaluation