Replace validity filter with generator function with fail counts