modified code and tests to accpet new filtering parameters