Simplified some of the plugin code.