     // MARK: Output creation
     ////////////////////////////////////////////////////////////////////////////
 
+    /**
+    Configures an `AVCatpureVideoDataOutput`.
+
+    - parameter delegate: The delegate to set.
+
+    - returns: A configured `AVCatpureVideoDataOutput`.
+    */
     private func configuredCameraOutput(delegate: AVCaptureVideoDataOutputSampleBufferDelegate) -> AVCaptureVideoDataOutput {
         let videoOutput = AVCaptureVideoDataOutput()
         let queue = dispatch_queue_create("be.delannoyk.boumboum", nil)

    case CameraDeviceInputCreationFailed(NSError)
}

public protocol BoumBoumDelegate: class {
    func boumBoum(boumBoum: BoumBoum, didFindAverageRate rate: UInt)
}

public class BoumBoum: NSObject {
    public enum State {
        case Running
        case Stopped
    }

    public let session: AVCaptureSession
    public let camera: AVCaptureDevice?
    public weak var delegate: BoumBoumDelegate?

    public private(set) var state = State.Stopped

    private let analyzer = BoumBoumAnalyzer()
    private var cameraInput: AVCaptureDeviceInput?
    private var videoOutput: AVCaptureVideoDataOutput?

    // MARK: Initialization
    ////////////////////////////////////////////////////////////////////////////

    public override convenience init() {
        self.init(session: AVCaptureSession(),
            camera: AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeVideo))
    }

    public init(session: AVCaptureSession, camera: AVCaptureDevice) {
        self.session = session
        self.camera = camera
        super.init()
    }

    private init(session: AVCaptureSession, camera: AVCaptureDevice?) {
        self.session = session
        self.camera = camera

    // MARK: Start / Stop
    ////////////////////////////////////////////////////////////////////////////

    /**
    Starts monitoring the heart rate.

    - throws: A `BoumBoumError` if something fails.
    */
    public func startMonitoring() throws {
        //Ensuring we have a camera
        guard let camera = camera else {
