#Troubleshooting
on_actions = {
    on_startup = {
        effect = {
            log = "-------------------- RUSSIA REWORKED --------------------"
            log = "Russia Reworked : Starting file debugging"
            log = "---------------------------------------------------------"
            set_global_flag = russia_reworked_enabled

            set_variable = { global.russia_reworked_core_file_missing = 0 }
            set_variable = { global.russia_reworked_noncore_file_missing = 0 }

            add_to_array = { global.russia_reworked_countries_load = ABK }
            add_to_array = { global.russia_reworked_countries_load = AEA }
            add_to_array = { global.russia_reworked_countries_load = AFF }
            add_to_array = { global.russia_reworked_countries_load = AIN }
            add_to_array = { global.russia_reworked_countries_load = ALT }
            add_to_array = { global.russia_reworked_countries_load = ANT }
            add_to_array = { global.russia_reworked_countries_load = ARM }
            add_to_array = { global.russia_reworked_countries_load = ASR }
            add_to_array = { global.russia_reworked_countries_load = ASY }
            add_to_array = { global.russia_reworked_countries_load = AZR }
            add_to_array = { global.russia_reworked_countries_load = BAB }
            add_to_array = { global.russia_reworked_countries_load = BLR }
            add_to_array = { global.russia_reworked_countries_load = BRN }
            add_to_array = { global.russia_reworked_countries_load = BRP }
            add_to_array = { global.russia_reworked_countries_load = BSK }
            add_to_array = { global.russia_reworked_countries_load = BUK }
            add_to_array = { global.russia_reworked_countries_load = BYA }
            add_to_array = { global.russia_reworked_countries_load = CAA }
            add_to_array = { global.russia_reworked_countries_load = CAF }
            add_to_array = { global.russia_reworked_countries_load = CAI }
            add_to_array = { global.russia_reworked_countries_load = CFR }
            add_to_array = { global.russia_reworked_countries_load = CHU }
            add_to_array = { global.russia_reworked_countries_load = CIN }
            add_to_array = { global.russia_reworked_countries_load = CIR }
            add_to_array = { global.russia_reworked_countries_load = CKK }
            add_to_array = { global.russia_reworked_countries_load = CLG }
            add_to_array = { global.russia_reworked_countries_load = CRI }
            add_to_array = { global.russia_reworked_countries_load = DAG }
            add_to_array = { global.russia_reworked_countries_load = EAC }
            add_to_array = { global.russia_reworked_countries_load = EAR }
            add_to_array = { global.russia_reworked_countries_load = EFR }
            add_to_array = { global.russia_reworked_countries_load = EUR }
            add_to_array = { global.russia_reworked_countries_load = FAT }
            add_to_array = { global.russia_reworked_countries_load = FSZ }
            add_to_array = { global.russia_reworked_countries_load = GEO }
            add_to_array = { global.russia_reworked_countries_load = GPM }
            add_to_array = { global.russia_reworked_countries_load = HEJ }
            add_to_array = { global.russia_reworked_countries_load = HES }
            add_to_array = { global.russia_reworked_countries_load = HIT }
            add_to_array = { global.russia_reworked_countries_load = HOS }
            add_to_array = { global.russia_reworked_countries_load = KAL }
            add_to_array = { global.russia_reworked_countries_load = KAR }
            add_to_array = { global.russia_reworked_countries_load = KAZ }
            add_to_array = { global.russia_reworked_countries_load = KBK }
            add_to_array = { global.russia_reworked_countries_load = KHI }
            add_to_array = { global.russia_reworked_countries_load = KKP }
            add_to_array = { global.russia_reworked_countries_load = KMI }
            add_to_array = { global.russia_reworked_countries_load = KUB }
            add_to_array = { global.russia_reworked_countries_load = KUR }
            add_to_array = { global.russia_reworked_countries_load = KYR }
            add_to_array = { global.russia_reworked_countries_load = MDE }
            add_to_array = { global.russia_reworked_countries_load = MED }
            add_to_array = { global.russia_reworked_countries_load = MEF }
            add_to_array = { global.russia_reworked_countries_load = MEL }
            add_to_array = { global.russia_reworked_countries_load = MES }
            add_to_array = { global.russia_reworked_countries_load = MOI }
            add_to_array = { global.russia_reworked_countries_load = NAC }
            add_to_array = { global.russia_reworked_countries_load = NAF }
            add_to_array = { global.russia_reworked_countries_load = NEJ }
            add_to_array = { global.russia_reworked_countries_load = NEN }
            add_to_array = { global.russia_reworked_countries_load = NOA }
            add_to_array = { global.russia_reworked_countries_load = NOV }
            add_to_array = { global.russia_reworked_countries_load = OCE }
            add_to_array = { global.russia_reworked_countries_load = ODA }
            add_to_array = { global.russia_reworked_countries_load = OVO }
            add_to_array = { global.russia_reworked_countries_load = POM }
            add_to_array = { global.russia_reworked_countries_load = PRM }
            add_to_array = { global.russia_reworked_countries_load = PRT }
            add_to_array = { global.russia_reworked_countries_load = RUA }
            add_to_array = { global.russia_reworked_countries_load = RHI }
            add_to_array = { global.russia_reworked_countries_load = ROS }
            add_to_array = { global.russia_reworked_countries_load = RYU }
            add_to_array = { global.russia_reworked_countries_load = SAE }
            add_to_array = { global.russia_reworked_countries_load = SAR }
            add_to_array = { global.russia_reworked_countries_load = SEA }
            add_to_array = { global.russia_reworked_countries_load = SFR }
            add_to_array = { global.russia_reworked_countries_load = SHB }
            add_to_array = { global.russia_reworked_countries_load = SHI }
            add_to_array = { global.russia_reworked_countries_load = SIB }
            add_to_array = { global.russia_reworked_countries_load = SIL }
            add_to_array = { global.russia_reworked_countries_load = SOJ }
            add_to_array = { global.russia_reworked_countries_load = SOV }
            add_to_array = { global.russia_reworked_countries_load = STP }
            add_to_array = { global.russia_reworked_countries_load = SWA }
            add_to_array = { global.russia_reworked_countries_load = TAJ }
            add_to_array = { global.russia_reworked_countries_load = TAN }
            add_to_array = { global.russia_reworked_countries_load = TAT }
            add_to_array = { global.russia_reworked_countries_load = TAY }
            add_to_array = { global.russia_reworked_countries_load = TEU }
            add_to_array = { global.russia_reworked_countries_load = THU }
            add_to_array = { global.russia_reworked_countries_load = TMS }
            add_to_array = { global.russia_reworked_countries_load = TOK }
            add_to_array = { global.russia_reworked_countries_load = TRE }
            add_to_array = { global.russia_reworked_countries_load = UDM }
            add_to_array = { global.russia_reworked_countries_load = UES }
            add_to_array = { global.russia_reworked_countries_load = UKR }
            add_to_array = { global.russia_reworked_countries_load = URA }
            add_to_array = { global.russia_reworked_countries_load = UZB }
            add_to_array = { global.russia_reworked_countries_load = VGE }
            add_to_array = { global.russia_reworked_countries_load = VLA }
            add_to_array = { global.russia_reworked_countries_load = VLG }
            add_to_array = { global.russia_reworked_countries_load = VYA }
            add_to_array = { global.russia_reworked_countries_load = YAK }
            add_to_array = { global.russia_reworked_countries_load = YAM }
            add_to_array = { global.russia_reworked_countries_load = TAN }
            add_to_array = { global.russia_reworked_countries_load = WAC }

            #Focus Trees
            log = "Russia Reworked : Scanning Focus Tree files"
            if = {
                limit = {
                    all_of_scopes = {
                        array = global.russia_reworked_soviets

                        has_focus_tree = russia2_soviet_focus
                    }
                }
                set_global_flag = russia_reworked_focus_loaded_sov
            }
            else = {
                for_each_scope_loop = {
                    array = global.russia_reworked_soviets
                    break = break_loop

                    if = {
                        limit = {
                            NOT = {
                                has_focus_tree = russia2_soviet_focus
                            }
                        }
                        log = " [THIS.GetTag] [THIS.GetName] is missing russia2_soviet_focus"
                        set_country_flag = russia_rework_focus_missing_sov
                        add_to_variable = { global.russia_reworked_core_file_missing = 1 }
                    }
                }
            }

            if = {
                limit = {
                    UKR = {
                        has_focus_tree = russia2_ukraine_focus
                    }
                }
                set_global_flag = russia_reworked_focus_loaded_ukr
            }
            else = {
                log = " [UKR.GetTag] [UKR.GetName] is missing russia2_ukraine_focus"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    all_of_scopes = {
                        array = global.russia_reworked_continents

                        has_focus_tree = russia2_continents_focus
                    }
                }
                set_global_flag = russia_reworked_focus_loaded_con
            }
            else = {
                for_each_scope_loop = {
                    array = global.russia_reworked_continents
                    break = break_loop

                    if = {
                        limit = {
                            NOT = {
                                has_focus_tree = russia2_continents_focus
                            }
                        }
                        log = " [THIS.GetTag] [THIS.GetName] is missing russia2_continents_focus"
                        set_country_flag = russia_rework_focus_missing_con
                        add_to_variable = { global.russia_reworked_core_file_missing = 1 }
                    }
                }
            }

            if = {
                limit = {
                    any_country = {
                        has_focus_tree = soviet_focus
                    }
                }
                for_each_scope_loop = {
                    array = global.countries
                    break = break_loop

                    if = {
                        limit = {
                            has_focus_tree = soviet_focus
                        }
                        log = " [THIS.GetTag] [THIS.GetName] has soviet_focus as their focus tree"
                        log = " NOTE : While this is not technically a missing file, it will most likely cause issues. This focus tree should NOT be used."
                        set_country_flag = russia_rework_using_soviet_focus
                        add_to_variable = { global.russia_reworked_noncore_file_missing = 1 }
                    }
                }
            }

            if = {
                limit = {
                    all_of_scopes = {
                        array = global.russia_reworked_russian_states

                        if = {
                            limit = {
                                NOT = {
                                    tag = UKR
                                }
                            }
                            has_focus_tree = russian_states_focus
                        }
                    }
                }
                set_global_flag = russia_reworked_focus_loaded_russian_states
            }
            else = {
                for_each_scope_loop = {
                    array = global.russia_reworked_russian_states
                    break = break_loop

                    if = {
                        limit = {
                            NOT = {
                                tag = UKR
                                has_focus_tree = russian_states_focus
                            }
                        }
                        log = " [THIS.GetTag] [THIS.GetName] is missing russian_states_focus"
                        set_country_flag = russia_rework_focus_missing_rsc
                        add_to_variable = { global.russia_reworked_core_file_missing = 1 }
                    }
                }
            }

            #Ideas
            log = "Russia Reworked : Scanning Idea files"
            SOV = {
                add_ideas = {
                    SOV_russia2_idea_load
                    UKR_russia2_idea_load
                    CRI_russia2_idea_load
                    CON_russia2_idea_load
                    RSC_russia2_idea_load
                    soviet_idea_load
                    soviet_nsb_idea_load
                    tajikistan_idea_load
                    turkmenistan_idea_load
                    uzbekistan_idea_load
                }
            }

            if = {
                limit = {
                    NOT = {
                        SOV = {
                            has_idea = SOV_russia2_idea_load
                        }
                    }
                }
                log = " Idea file russia2_russia.txt seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }
            if = {
                limit = {
                    NOT = {
                        SOV = {
                            has_idea = UKR_russia2_idea_load
                        }
                    }
                }
                log = " Idea file russia2_ukraine.txt seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }
            if = {
                limit = {
                    NOT = {
                        SOV = {
                            has_idea = CRI_russia2_idea_load
                        }
                    }
                }
                log = " Idea file russia2_crimea.txt seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }
            if = {
                limit = {
                    NOT = {
                        SOV = {
                            has_idea = CON_russia2_idea_load
                        }
                    }
                }
                log = " Idea file russia2_continents.txt seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }
            if = {
                limit = {
                    NOT = {
                        SOV = {
                            has_idea = RSC_russia2_idea_load
                        }
                    }
                }
                log = " Idea file russia2_russian_states.txt seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }
            if = {
                limit = {
                    NOT = {
                        SOV = {
                            has_idea = soviet_idea_load
                        }
                    }
                }
                log = " Idea file soviet.txt seems to be missing"
                add_to_variable = { global.russia_reworked_noncore_file_missing = 1 }
            }
            if = {
                limit = {
                    NOT = {
                        SOV = {
                            has_idea = soviet_nsb_idea_load
                        }
                    }
                }
                log = " Idea file soviet.txt seems to be missing"
                add_to_variable = { global.russia_reworked_noncore_file_missing = 1 }
            }
            if = {
                limit = {
                    NOT = {
                        SOV = {
                            has_idea = tajikistan_idea_load
                        }
                    }
                }
                log = " Idea file tajikstan.txt has been modified"
                add_to_variable = { global.russia_reworked_noncore_file_missing = 1 }
            }
            if = {
                limit = {
                    NOT = {
                        SOV = {
                            has_idea = turkmenistan_idea_load
                        }
                    }
                }
                log = " Idea file turkmenistan.txt seems to be missing"
                add_to_variable = { global.russia_reworked_noncore_file_missing = 1 }
            }
            if = {
                limit = {
                    NOT = {
                        SOV = {
                            has_idea = uzbekistan_idea_load
                        }
                    }
                }
                log = " Idea file uzbekistan.txt seems to be missing"
                add_to_variable = { global.russia_reworked_noncore_file_missing = 1 }
            }

            SOV = {
                remove_ideas = {
                    SOV_russia2_idea_load
                    UKR_russia2_idea_load
                    CRI_russia2_idea_load
                    CON_russia2_idea_load
                    RSC_russia2_idea_load
                    soviet_idea_load
                    soviet_nsb_idea_load
                    tajikistan_idea_load
                    CRI_russia2_idea_load
                    turkmenistan_idea_load
                    uzbekistan_idea_load
                }
            }

            #Characters
            log = "Russia Reworked : Scanning Character files"
            if = {
                limit = {
                    NOT = {
                        SOV = {
                            has_character = russia_reworked_load_russian_states_characters
                        }
                    }
                }
                log = " Character file Russia2_russian_states.txt seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        SOV = {
                            has_character = russia_reworked_load_kazak_characters
                        }
                    }
                }
                log = " Character file KAZ.txt has been modified"
                add_to_variable = { global.russia_reworked_noncore_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        SOV = {
                            has_character = russia_reworked_load_kyrgy_characters
                        }
                    }
                }
                log = " Character file KYR.txt has been modified"
                add_to_variable = { global.russia_reworked_noncore_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        SOV = {
                            has_character = russia_reworked_load_generic_characters
                        }
                    }
                }
                log = " Character file Russia2_generic.txt seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        SOV = {
                            has_character = russia_reworked_load_russian_characters
                        }
                    }
                }
                log = "  Character file Russia2_SOV.txt seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        SOV = {
                            has_character = russia_reworked_load_ukrainian_characters
                        }
                    }
                }
                log = " Character file Russia2_UKR.txt seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            #Events
            log = "Russia Reworked : Scanning Event files"
            SOV = {
                country_event = baltic.2092066524
                country_event = russia2_baltic.2092066524
                country_event = NSB_poland_events.2092066524
                country_event = NSB_soviet_policies_of_collective_security.2092066524
                country_event = russia2_bulgaria.2092066524
                country_event = russia2_china.2092066524
                country_event = russia2_communist_china.2092066524
                country_event = russia2_continent.2092066524
                country_event = russia2_england.2092066524
                country_event = finland.2092066524
                country_event = russia2_finland.2092066524
                country_event = russia2_france.2092066524
                country_event = russia2_generic.2092066524
                country_event = russia2_germany.2092066524
                country_event = russia2_italy.2092066524
                country_event = russia2_japan.2092066524
                country_event = russia2_manchukuo.2092066524
                country_event = russia2_mongolia.2092066524
                country_event = newsrussia2.2092066524
                country_event = russia2_poland.2092066524
                country_event = russia2_revolutions.2092066524
                country_event = russia2_romania.2092066524
                country_event = soviet.2092066524
                country_event = russia2_russia.2092066524
                country_event = russia2_spain.2092066524
                country_event = russia2_tannu.2092066524
                country_event = russia2_turkey.2092066524
                country_event = russia2_ukraine.2092066524
                country_event = russia2_america.2092066524
                country_event = russia2_yaltas.2092066524
                country_event = russia2_russian_states.2092066524
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_baltic
                    }
                }
                log = " Baltic.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_noncore_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_baltics
                    }
                }
                log = " Russia2_baltic.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_poland_nsb
                    }
                }
                log = " poland_nsb.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_russia_soviet_nsb
                    }
                }
                log = " soviet_nsb.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_bulgarias
                    }
                }
                log = " Russia2_bulgaria.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_chinas
                    }
                }
                log = " Russia2_china.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_wtt_prcs
                    }
                }
                log = " Russia2_communist_china.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_continents
                    }
                }
                log = " Russia2_continent.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_englands
                    }
                }
                log = " Russia2_england.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_finland
                    }
                }
                log = " Finland.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_noncore_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_finlands
                    }
                }
                log = " Russia2_finland.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_frances
                    }
                }
                log = " Russia2_france.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_generics
                    }
                }
                log = " Russia2_generic.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_germanys
                    }
                }
                log = " Russia2_germany.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_italys
                    }
                }
                log = " Russia2_italy.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_japans
                    }
                }
                log = " Russia2_japan.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_manchukuos
                    }
                }
                log = " Russia2_manchukuo.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_mongolias
                    }
                }
                log = " Russia2_mongolia.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_newsrussia2
                    }
                }
                log = " Russia2_news.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_noncore_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_polands
                    }
                }
                log = " Russia2_poland.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_revolutions
                    }
                }
                log = " Russia2_revolution.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_romanias
                    }
                }
                log = " Russia2_romania.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_soviet
                    }
                }
                log = " Soviet.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_soviets
                    }
                }
                log = " Russia2_soviet.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_spains
                    }
                }
                log = " Russia2_spain.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_tannu
                    }
                }
                log = " russia2_tannu.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_turkeys
                    }
                }
                log = " Russia2_turkey.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_ukraine
                    }
                }
                log = " russia2_ukraine.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_americas
                    }
                }
                log = " Russia2_america.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_yaltas
                    }
                }
                log = " Russia2_yalta.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            if = {
                limit = {
                    NOT = {
                        has_global_flag = russia_reworked_events_loaded_russian_states
                    }
                }
                log = " RussianStatesRussia2.txt event file seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
            }

            #Countries
            log = "Russia Reworked : Scanning Country files"
            for_each_loop = {
                array = global.russia_reworked_countries_load
                break = break_array
                value = v
                index = i

                if = {
                    limit = {
                        NOT = {
                            is_in_array = {
                                array = global.russia_reworked_countries
                                value = var:v
                            }
                        }
                    }
                    add_to_variable = { global.russia_reworked_core_file_missing = 1 }
                    if = {
                        limit = {
                            is_in_array = {
                                array = global.countries
                                value = var:v
                            }
                        }
                        log = " Country with ID [?var:v] is present ([?var:v.GetName]) but not loaded properly"
                        var:v = {
                            set_country_flag = russia_rework_country_missing
                        }
                    }
                    else = {
                        log = " Country with ID [?var:v] is missing ([?var:v.GetName])"
                    }
                }
            }

            #Other Files
            log = "Russia Reworked : Scanning Other files"
            SOV = {
                add_country_leader_trait = russia2_load_trait
            }
            if = {
                limit = {
                    SOV = {
                        has_country_leader_with_trait = russia2_load_trait
                    }
                }
                SOV = {
                    remove_country_leader_trait = russia2_load_trait
                }
                set_global_flag = russia_reworked_traits_loaded
            }
            else = {
                log = " File Russia2Traits.txt seems to be missing"
                add_to_variable = { global.russia_reworked_core_file_missing = 1 }
                set_global_flag = russia_reworked_traits_missing
            }

            if = {
                limit = {
                    check_variable = {
                        var = global.russia_reworked_core_file_missing
                        value = 1
                        compare = greater_than_or_equals
                    }
                }
                set_global_flag = russia_reworked_error
                log = "Russia Reworked : [?global.russia_reworked_core_file_missing] core files missing"
                log = "Russia Reworked : [?global.russia_reworked_noncore_file_missing] non core files missing"
            }
            else_if = {
                limit = {
                    check_variable = {
                        var = global.russia_reworked_noncore_file_missing
                        value = 1
                        compare = greater_than_or_equals
                    }
                }
                log = "Russia Reworked : [?global.russia_reworked_noncore_file_missing] non core files missing"
            }
            else = {
                log = "Russia Reworked : No error detected"
            }

            set_global_flag = russia_reworked_loaded
            log = "---------------------------------------------------------"
            log = "Russia Reworked : End of debugging"
            log = "-------------------- RUSSIA REWORKED --------------------"
        }
    }
}