Cleanup upgrade functions