Feature/offline mode

Feature dev for offline mode, error handling (partial), bug fixing, code refactoring.
More changes will come later for error handling (not in this pr)