replaced loop with filter