added filtration code (not yet used)