Working out the plugin API, refactored plugin loading a little