Pull in a bunch of changes CunningGabe made to v4 that use more predicates and flags instead of direct feature checks