Merge Krinkle's cleanup branch

See individual commits.