[enh] Backport prerefactoring branch modifications