implemented the destroy function of the plugin