     
     static let sharedManager = VoiceMessageAttachmentCacheManager()
     
-    private var completionCallbacks = [CompletionCallbackKey: [CompletionWrapper]]()
+    private var completionCallbacks = [String: [CompletionWrapper]]()
     private var samples = [String: [Int: [Float]]]()
     private var durations = [String: TimeInterval]()
     private var finalURLs = [String: URL]()
     
-    private let workQueue: DispatchQueue
-    
     private init() {
-        workQueue = DispatchQueue(label: "io.element.VoiceMessageAttachmentCacheManager.queue", qos: .userInitiated)
+        
     }
     
     func loadAttachment(_ attachment: MXKAttachment, numberOfSamples: Int, completion: @escaping (Result<VoiceMessageAttachmentCacheManagerLoadResult, Error>) -> Void) {

            }
        }
        
        self.completionCallbacks[callbackKey] = nil
    }
    
    private func invokeFailureCallbacksForIdentifier(_ identifier: String, error: Error) {
        let callbackKey = CompletionCallbackKey(eventIdentifier: identifier, requiredNumberOfSamples: samples.count)
        
        guard let callbacks = completionCallbacks[callbackKey] else {
            return
        }
        

            return
        }
        
        if let finalURL = finalURLs[identifier], let duration = durations[identifier], let samples = samples[identifier]?[numberOfSamples] {
            let result = VoiceMessageAttachmentCacheManagerLoadResult(eventIdentifier: identifier, url: finalURL, duration: duration, samples: samples)
            completion(Result.success(result))
            return
        }
        
        self.enqueueLoadAttachment(attachment, identifier: identifier, numberOfSamples: numberOfSamples, completion: completion)
    }
    
    private func enqueueLoadAttachment(_ attachment: MXKAttachment, identifier: String, numberOfSamples: Int, completion: @escaping (Result<VoiceMessageAttachmentCacheManagerLoadResult, Error>) -> Void) {

        if var callbacks = completionCallbacks[identifier] {
            callbacks.append(CompletionWrapper(completion))
            completionCallbacks[identifier] = callbacks
            return
        } else {
            completionCallbacks[identifier] = [CompletionWrapper(completion)]
        }
        
        func sampleFileAtURL(_ url: URL, duration: TimeInterval) {
            let analyser = WaveformAnalyzer(audioAssetURL: url)
            analyser?.samples(count: numberOfSamples, completionHandler: { samples in
                // Dispatch back from the WaveformAnalyzer's internal queue
                DispatchQueue.main.async {
                    guard let samples = samples else {
                        self.invokeFailureCallbacksForIdentifier(identifier, error: VoiceMessageAttachmentCacheManagerError.samplingError)
                        return
