Trac 28709 via kienstra

Amends #29.
Incorporates #36.

/cc @kienstra @celloexpressions