             self.beginSession();
         })
     }
-    
+
     //MARK: AVFoundation Implementation
     func beginSession(){
         let currentDevice: UIDevice = UIDevice.current

    var stillImageInput: AVCaptureDeviceInput? //registers an input port for communicating with the connection
    var stillImageOutput: AVCaptureStillImageOutput? //output

    let filemgr = FileManager.default
    var mediaDir: String = "";
    var thumbDir: String = "";
    var rawOrient: String = "";
    
    var flashState = 2; //0 = off, 1 = On, 2 = Auto
    var quadState = 0; //0 = UL , 1 = UR, 2 = LL, 3 = LR
    var badgeCounter = 0;
    var oldOrientationValue: UIDeviceOrientation = UIDeviceOrientation.portrait;
    
     //send data back to the plugin class
    var jsonGen = HappieCameraJSON();
    var thumbGen = HappieCameraThumb();

        }
        captureSession.startRunning()
    }

    override func viewDidDisappear( _ p: Bool ) {
        super.viewDidDisappear( p )
        uMM.stopAccelerometerUpdates()
        captureSession.stopRunning()
    }

    //MARK: State Functions
    override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?){
        super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil);
