Merge William' #1154 pull request

My changes introduced a conflict; I just fixed that now.