Comment 17 for bug 197781

Created attachment 303723
Unbitrotted WIP patch v0.3

Unbitrotted to the extent that it builds and appears to work - only to be considered as a starting point for the moment.