15931, 15918, 15919

Another set of new directives and smallish fixes.

Fixes #15931, #15918, #15919.

This is based on @sirthias' #16094 (9c0a2f1 is the first commit to review) and also includes a slightly adapted commit from @bthuillier.