Improvements to cloud sync code