         
     }
     
+    ///////////////////////////////////////////////////////////////////////
     
     override func didReceiveMemoryWarning() {
         super.didReceiveMemoryWarning()

        println("App will enter foreground.")
        
        if self.config.boolForKey("useAutoTheme") == true {
            self.beginCaptureSession()
            self.setupImageCaptureTimer()
        } else {
            self.setupWithoutAutoTheme()
        }

    
    
    func endCaptureSession() {
        dispatch_async(self.sessionQueue, {
            if let session = self.captureSession {
                if session.running == true {
                    println("Stopping capture session")
                    session.stopRunning()
                }
            }
            
            self.captureSession = nil
            self.imageOutput    = nil
            self.captureDevice  = nil
        })
    }
    
    
