 
     private func applicationDidBecomeActive(notification: NSNotification) {
         log("Application Did Become Active Notification")
+        applicationInactive = false
         dispatch_async(smartcardQueue) {
             self.openSmartcard()
             self.checkSmartcard()


    private func applicationWillResignActive(notification: NSNotification) {
        log("Application Will Resign Active Notification")
        dispatch_async(smartcardQueue) {
            self.closeSmartcard()
        }

        return SITHSManagerError.SmartcardError(message: message, code: code)
    }

    private func setErrorState(error: SITHSManagerError) {
        if applicationInactive {
            // We're suppressing all error states while application is inactive. This will be resolved again when the application enters forground
            // and  a new connection is made (that of course then could result in the same error, and will then be set as state correctly)
            return
        }

        internalState = .Error(error: error)
    }

    func log(message: String) {
        dispatch_async(dispatch_get_main_queue()) {
            self.debugLogClosure?(message)
