         }
     }
 }
+
+
+// MARK: Private Methods
+
+extension CaptureSessionAssetWriterCoordinator {
+
+    private func fetchConnections(fromVideoDataOutput videoDataOutput: AVCaptureVideoDataOutput, andAudioDataOutput audioDataOutput: AVCaptureAudioDataOutput) throws -> (videoConnection: AVCaptureConnection!, audioConnection: AVCaptureConnection!) {
+
+        guard let unwrappedVideoConnection = videoDataOutput.connectionWithMediaType(AVMediaTypeVideo) else {
+            throw MedusaError.CaptureDeviceError
+        }
+
+        guard let unwrappedAudioConnection = audioDataOutput.connectionWithMediaType(AVMediaTypeAudio) else {
+            throw MedusaError.AudioDeviceError
+        }
+
+        if unwrappedVideoConnection.supportsVideoStabilization {
+            unwrappedVideoConnection.preferredVideoStabilizationMode = .Auto
+        }
+
+        return (videoConnection: unwrappedVideoConnection, audioConnection: unwrappedAudioConnection)
+
+    }
+}
+
+


        synchronized(self) {
            guard recordingStatus == .StoppingRecording else { return }
            // No state transition, we are still in the process of stopping.
            // We will be stopped once we save to the assets library.
        }

        synchronized(self) {


        self.recordingURL = recordingURL

        try super.init(sessionPreset: sessionPreset, position: position)

        try addOutput(videoDataOutput, toCaptureSession: captureSession)
        try addOutput(audioDataOutput, toCaptureSession: captureSession)

        (videoConnection, audioConnection) = try fetchConnections(fromVideoDataOutput: videoDataOutput, andAudioDataOutput: audioDataOutput)

        let videoDataOutputQueue = dispatch_queue_create("top.limon.capturesession.videodata", DISPATCH_QUEUE_SERIAL)
        let audioDataOutputQueue = dispatch_queue_create("top.limon.capturesession.audiodata", DISPATCH_QUEUE_SERIAL)
