clean up working for merging the filter.

Not tested for bigge amounts of data