Manual merge of pull requests from Patrick