Updated iCloud logic