Small changes to align with the same changes done on the 2.2 branch. All small tweaks to the code.