     captureOutput: AVCaptureOutput!,
     didOutputMetadataObjects metadataObjects: [AnyObject]!,
     fromConnection connection: AVCaptureConnection!) {
-      guard !didCapture && metadataObjects.count > 0,
+      guard metadataObjects.count > 0,
         let metadataObject = metadataObjects.first as? AVMetadataMachineReadableCodeObject
         where metadataObject.type == AVMetadataObjectTypeQRCode,
         let url = NSURL(string: metadataObject.stringValue),
         let account = Account(url: url) else { return }
-      didCapture = true
+      output.setMetadataObjectsDelegate(nil, queue: nil)
       presentingViewController?.dismissViewControllerAnimated(true) {
         self.delegate?.createAccount(account)
       }

    let device = AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeVideo)
    if let input = try? AVCaptureDeviceInput(device: device) {
      session.addInput(input)
      let output = AVCaptureMetadataOutput()
      session.addOutput(output)
      output.setMetadataObjectsDelegate(self, queue: dispatch_get_main_queue())
      output.metadataObjectTypes = [AVMetadataObjectTypeQRCode]

  @IBOutlet weak var allowCameraAccessLabel: UILabel!
  var delegate: AccountCreationDelegate?
  private var session = AVCaptureSession()
  private let output = AVCaptureMetadataOutput()
  private var layer: AVCaptureVideoPreviewLayer?

  @IBAction func didPressCancel(sender: UIBarButtonItem) {
    output.setMetadataObjectsDelegate(nil, queue: nil)
    presentingViewController?.dismissViewControllerAnimated(true, completion: nil)
  }

