             }
         }
         print("FACE",faces)
+        
         if (faces.count>0){
             dispatch_async(dispatch_get_main_queue(), {() -> Void in
                 CATransaction.begin()

            possibleCameraInput = try AVCaptureDeviceInput(device: frontCameraDevice)
        } catch _ {
            possibleCameraInput = nil
        }
        if let backCameraInput = possibleCameraInput as? AVCaptureDeviceInput {
            if self.session.canAddInput(backCameraInput) {
                self.session.addInput(backCameraInput)
            }
        }
        previewLayer = AVCaptureVideoPreviewLayer(session: session)

        for metadataObject in metadataObjects as! [AVMetadataObject] {
            if metadataObject.type == AVMetadataObjectTypeFace {
                if let faceObject = metadataObject as? AVMetadataFaceObject {
                    let transformedMetadataObject = previewLayer.transformedMetadataObjectForMetadataObject(metadataObject)
                    let face:(id: Int, frame: CGRect) = (faceObject.faceID, transformedMetadataObject.bounds)
                    faces.append(face)
