clean up plugin code