Redo the plugin system somewhat so that it now works. Fixes #1.