adding online mode and offline mode