Tests and fixes for PluginManager
Restructure things and fix imports