Performance improvement of PluginManager with clean up some plugin code.