     }
     
     static func tryToExecute(timeNow: Date, completion: @escaping (Bool) -> Void) {
+        let eventCountConditions = checkEventCountConditions()
+        let eventDateConditions = checkEventDateConditions(timeNow: timeNow)
+        let executionCountConditions = checkExecutionCountConditions()
+        let executionDateConditions = checkExecutionDateConditions(timeNow: timeNow)
+        
+        let finalResult = eventCountConditions && eventDateConditions && executionCountConditions && executionDateConditions
+        
+        if finalResult {
+            incrementExecutionsCounter()
+            saveLastExecutionDate(timeNow: timeNow)
+        }
+        
+        completion(finalResult)
+    }
+    
+    private static func checkEventCountConditions() -> Bool {
+        let result: Bool
+        
         let currentCount = currentEventsCount
-        
-        var countBasedConditions: Bool
-        
         if let max = maxEventsPermitted, let min = minEventsRequired {
-            countBasedConditions = (max >= currentCount) && (min <= currentCount)
+            result = (max >= currentCount) && (min <= currentCount)
         } else if let max = maxEventsPermitted {
-            countBasedConditions = max >= currentCount
+            result = max >= currentCount
         } else if let min = minEventsRequired {
-            countBasedConditions = min <= currentCount
-        } else {
-            countBasedConditions = true
-        }
-        
-        var eventDateBasedConditions: Bool
+            result = min <= currentCount
+        } else {
+            result = true
+        }
+        
+        return result
+    }
+    
+    private static func checkEventDateConditions(timeNow: Date) -> Bool {
+        let result: Bool
         
         if let minSecondsInterval = minSecondsSinceFirstEvent,
             let firstEventDate = currentFirstEventDate {
             let secondsSinceFirstEvent = timeNow.timeIntervalSince1970 - firstEventDate.timeIntervalSince1970
             
-            eventDateBasedConditions = secondsSinceFirstEvent > minSecondsInterval
-        } else {
-            eventDateBasedConditions = true
-        }
-        
-        var executionCountBasedConditions: Bool
+            result = secondsSinceFirstEvent > minSecondsInterval
+        } else {
+            result = true
+        }
+        
+        return result
+    }
+    
+    private static func checkExecutionCountConditions() -> Bool {
+        let result: Bool
         
         if let maxExecutions = maxExecutionsPermitted {
-            executionCountBasedConditions = currentExecutionsCount < maxExecutions
-        } else {
-            executionCountBasedConditions = true
-        }
-        
-        var executionDateBasedConditions: Bool
+            result = currentExecutionsCount < maxExecutions
+        } else {
+            result = true
+        }
+        
+        return result
+    }
+    
+    private static func checkExecutionDateConditions(timeNow: Date) -> Bool {
+        let result: Bool
         
         if let minSecondsInterval = minSecondsBetweenExecutions,
             let lastExecutionDate = currentLastExecutionDate {
             let secondsSinceLastExecution = timeNow.timeIntervalSince1970 - lastExecutionDate.timeIntervalSince1970
             
-            executionDateBasedConditions = secondsSinceLastExecution > minSecondsInterval
-        } else {
-            executionDateBasedConditions = true
-        }
-        
-        let finalResult = countBasedConditions && eventDateBasedConditions && executionCountBasedConditions && executionDateBasedConditions
-        
-        if finalResult {
-            incrementExecutionsCounter()
-            saveLastExecutionDate(timeNow: timeNow)
-        }
-        
-        completion(finalResult)
-    }
-    
+            result = secondsSinceLastExecution > minSecondsInterval
+        } else {
+            result = true
+        }
+        
+        return result
+    }
     
     static func tryToExecute(completion: @escaping (Bool) -> Void) {
         tryToExecute(timeNow: Date(), completion: completion)

        userDefaults.synchronize()
    }
    
    private static var currentEventsCount: Int {
        let currentCount = userDefaults.value(forKey: kDefaultsEventsCount)
        var count = 0
        

        userDefaults.synchronize()
    }
    
    static var currentFirstEventDate: Date? {
        return userDefaults.object(forKey: kDefaultsFirstEventDate) as? Date
    }
    
    static var currentLastExecutionDate: Date? {
        return userDefaults.object(forKey: kDefaultsLastExecutionDate) as? Date
    }
    
