Partially reverted refs #27054 except for one of the tests as this solution supersedes that one. Thanks Shai Berger for the review.
Thanks Simon Charette for help.