Land #3594 - updated PR rebased on latest

I squashed a few of the 'oops' commits and fixed some of the merge conflicts with master by doing a fresh rebase. This should make it a little easier to follow in the merge as well.