Hand-merged code

Merged a bunch of stuff from master.