Major overhaul with V1.5
Merge https://github.com/junovitch/misc-code