Here's a simpler implemention of #249

This avoids a circular import by burying an import rather than folding
two files together.