     
     private func prepareToRecord() {
         // create recording queue
-        let opaque = Unmanaged<SpeechToTextRecorder>.passUnretained(self).toOpaque()
-        let pointer = UnsafeMutableRawPointer(opaque)
+        let pointer = UnsafeMutableRawPointer(Unmanaged.passUnretained(self).toOpaque())
         AudioQueueNewInput(&format, callback, pointer, nil, nil, 0, &queue)
         
         // ensure queue was set

 
    internal func startRecording() throws {
        guard !isRecording else { return }
        guard let queue = queue else { return }
        try session.setCategory(AVAudioSessionCategoryPlayAndRecord, with: .defaultToSpeaker)
        try session.setActive(true)
        self.prepareToRecord()
        self.isRecording = true
        AudioQueueStart(queue, nil)
    }
 

        userData, queue, bufferRef, startTimeRef, numPackets, packetDescriptions in
        
        // parse `userData` as `SpeechToTextRecorder`
        guard let userData = userData else { return }
        let audioRecorder = Unmanaged<SpeechToTextRecorder>.fromOpaque(userData).takeUnretainedValue()
        
        // dereference pointers
        let buffer = bufferRef.pointee
        let startTime = startTimeRef.pointee
        
        // calculate number of packets
