union operation refactoring