Refactored syncing in AppDelegate