Cleanup and pickle support