pull some filtering logic into the base module to reduce duplication