                 .map { $0.configurationRuleWrapper }
         }
 
-        private func merged(
-            customRules rules: [ConfigurationRuleWrapper], mode: RulesMode, with child: RulesWrapper
+        private func mergedCustomRules(
+            newAllRulesWrapped: [ConfigurationRuleWrapper], mode: RulesMode, with child: RulesWrapper
         ) -> [ConfigurationRuleWrapper] {
             guard
-                let customRulesRule = (allRulesWrapped.first {
-                    $0.rule is CustomRules
-                })?.rule as? CustomRules,
-                let childCustomRulesRule = (child.allRulesWrapped.first {
-                    $0.rule is CustomRules
-                })?.rule as? CustomRules
+                let parentCustomRulesRule = (allRulesWrapped.first { $0.rule is CustomRules })?.rule
+                    as? CustomRules,
+                let childCustomRulesRule = (child.allRulesWrapped.first { $0.rule is CustomRules })?.rule
+                    as? CustomRules
             else {
                 // Merging is only needed if both parent & child have a custom rules rule
-                return rules
-            }
-
-            let customRulesFilter: (RegexConfiguration) -> (Bool)
-            switch mode {
-            case .allEnabled:
-                customRulesFilter = { _ in true }
-
-            case let .only(onlyRules):
-                customRulesFilter = { onlyRules.contains($0.identifier) }
-
-            case let .default(disabledRules, _):
-                customRulesFilter = { !disabledRules.contains($0.identifier) }
-            }
-
+                return newAllRulesWrapped
+            }
+
+            // Create new custom rules rule, prioritizing child custom rules
             var configuration = CustomRulesConfiguration()
-            configuration.customRuleConfigurations = Set(customRulesRule.configuration.customRuleConfigurations)
-                .union(Set(childCustomRulesRule.configuration.customRuleConfigurations))
-                .filter(customRulesFilter)
-
-            var customRules = CustomRules()
-            customRules.configuration = configuration
-
-            return rules.filter { !($0.rule is CustomRules) } + [(customRules, true)]
+            configuration.customRuleConfigurations = Array(
+                Set(childCustomRulesRule.configuration.customRuleConfigurations)
+                    .union(Set(parentCustomRulesRule.configuration.customRuleConfigurations))
+            )
+            var newCustomRulesRule = CustomRules()
+            newCustomRulesRule.configuration = configuration
+
+            return newAllRulesWrapped.filter { !($0.rule is CustomRules) } + [(newCustomRulesRule, true)]
         }
 
         private func mergeDefaultMode(

                newMode = .allEnabled
            }

            // Assemble & return merged Rules
            return RulesWrapper(
                mode: newMode,
                allRulesWrapped: merged(
                    customRules: newAllRulesWrapped,
                    mode: newMode,
                    with: child
                ),

            if let cachedResultingRules = cachedResultingRules { return cachedResultingRules }

            // Calculate value
            let customRulesFilter: (RegexConfiguration) -> (Bool)
            var resultingRules = [Rule]()
            switch mode {
            case .allEnabled:
                customRulesFilter = { _ in true }
                resultingRules = allRulesWrapped.map { $0.rule }

            case var .only(onlyRulesRuleIdentifiers):
                customRulesFilter = { onlyRulesRuleIdentifiers.contains($0.identifier) }
                onlyRulesRuleIdentifiers = validate(ruleIds: onlyRulesRuleIdentifiers, valid: validRuleIdentifiers)
                resultingRules = allRulesWrapped.filter { tuple in
                    onlyRulesRuleIdentifiers.contains(type(of: tuple.rule).description.identifier)
                }.map { $0.rule }

            case var .default(disabledRuleIdentifiers, optInRuleIdentifiers):
                customRulesFilter = { !disabledRuleIdentifiers.contains($0.identifier) }
                disabledRuleIdentifiers = validate(ruleIds: disabledRuleIdentifiers, valid: validRuleIdentifiers)
                optInRuleIdentifiers = validate(ruleIds: optInRuleIdentifiers, valid: validRuleIdentifiers)
                resultingRules = allRulesWrapped.filter { tuple in
