Adding background sync functionality