Cleanup of write, etc.