Clean up plugin code