Further work on #206.

Today's fixes for #206 have been a little ugly.  The much nicer fix
will be to tackle #195