Work in progress: create a plugin architecture for things to fit in

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