Refactored the PluginManager