Syncing up a bit of the changes.

Taking a bit of the current changes and making sure that they are backported to the r2.2 branch.