split up modifications of reverted commit

Here is that commit split up a bit
What does this do?