added compliance to new PYFilter
optimized filtering