create a plugin architecture for things to fit into

Probably not quite ready yet, still lacking some test coverage, but almost there.

Absolutely correct, sorry this wasn't already fixed - I got distracted after writing that comment.  Really glad we found some empirical verification of the issue though, since test coverage here is obviously weak!