[CDF-255] cherry-pick from master & 5-trunk into core-refactor