refactored filterAcc and union to be more performant
refactored filterAcc and union to be more performant