Refactoring and updates to support offline mode
Refactoring and updates to support offline mode