Added functionality to sync with Firebase if enabled in settings