[TIMOB-17166] [TC-4136] (3_3_X) Code cleanup

Cherry Pick PR #5810 and PR #5804 into 3_3_X