Thanks to fricklerhandwerk for the many suggestions, most of which I have fixupped into preceding commits.