Merge pull request #2869 from BrzVlad/feature-mod-union-opt