Partially updated for new PluginBase.