Merging everything from courier back into master

Except namespace changes.