Refactor composite filters to a common foundation function