Backport recent QPA fixes
This merge request includes a couple of refactoring commits to simplify the cherry-picking process.
Edited by Vlad Zahorodnii
This merge request includes a couple of refactoring commits to simplify the cherry-picking process.