add offline mode and tests