trunk build fix uplift; don't pick if rebasing
Add comments to aid understanding, some warnings, trivial code changes