     objStorage = ObjectStorage(projectId: connProps.projectId)
   }
 
-  func getObjectStorage(completionHandler: (_ objStorage: ObjectStorage?) -> Void) {
+  mutating func getObjectStorage(completionHandler: @escaping (_ objStorage: ObjectStorage?) -> Void) {
     Log.verbose("Starting task in serialized block (getting ObjectStorage instance)...")
     connectQueue.sync {
         self.connect(completionHandler: completionHandler)


    // Network call should be synchronous since we need to know the result before proceeding.
    let semaphore = DispatchSemaphore(value: 0)
    
    Log.verbose("Making network call synchronous...")
    objStorage.connect(userId: connProps.userId, password: connProps.password, region: ObjectStorage.REGION_DALLAS) { error in
      if let error = error {
        let errorMsg = "Could not connect to Object Storage."
        Log.error("\(errorMsg) Error was: '\(error)'.")
        self.authenticated = false
      } else {
        Log.verbose("Successfully obtained authentication token for Object Storage.")
        self.authenticated = true
        self.lastAuthenticatedTs = Date()
        Log.verbose("lastAuthenticatedTs is \(self.lastAuthenticatedTs).")
      }
      Log.verbose("Signaling semaphore...")
      semaphore.signal()
      
    }

    let _ = semaphore.wait(timeout: DispatchTime.distantFuture)
    Log.verbose("Continuing execution after synchronous network call...")
  }


    completionHandler(param)
  }

  private mutating func connect(completionHandler: (_ objStorage: ObjectStorage?) -> Void) {
    Log.verbose("Determining if we have an ObjectStorage instance ready to use...")
    if authenticated, let lastAuthenticatedTs = lastAuthenticatedTs {
      // Check when was the last time we got an auth token
