Cleanup and stability fixes