             }
 
             if currentException != nil {
-                let exRemaining = currentException?.remaining(time: time)
-                if findCurrentSession(time: time + exRemaining!) != nil {
-                    return exRemaining!
+                var exRemaining = currentException!.remaining(time: time)
+                for exception in exceptions! {
+                    if isInSession(exception, time + exRemaining) {
+                        exRemaining += exception.remaining(time: time + exRemaining)
+                    }
+                }
+                if findCurrentSession(time: time + exRemaining) != nil {
+                    return exRemaining
                 }
             }
         }
 
         return findNearest(sessions, exceptions, time)
     }
-
-    var recursiveCount = 0
 
     func findNearest(_ sessions: [Session]?, _ exceptions: [Session]?, _ time: Int64) -> Int64 {
         var nearestTime = Int64.max

    }

    func nextChange(time: Int64) -> Int64 {
        recursiveCount = 0

        let currentSession = findCurrentSession(time: time)
        if currentSession != nil {
            let nearestException = findNearest(exceptions, nil, time)

                }

                var dif = s - t
                if dif <= 0 {
                    dif += session.cycle!.int64Value
                }
                if !session.isInPeriod(time: time + dif) {
