It seems that the LHCb issue causing the first reversion of this MR has been fixed.
Now re-adding the original merge, with a couple of fixes.