pull out passes filter functionality into it's own function

Probably the filter function should be renamed to make it clear that it's only half the actual filtering, but that's out of scope for now.