Apply jogloran's manual merge of timothyarmes fork.