Final version of filtering -- runs the best under pypy