diff --git a/maps/mountain_fortress_v3/balance.lua b/maps/mountain_fortress_v3/balance.lua
index 133f41f7..e4b7a07f 100644
--- a/maps/mountain_fortress_v3/balance.lua
+++ b/maps/mountain_fortress_v3/balance.lua
@@ -1,9 +1,5 @@
-local Event = require 'utils.event'
 local Difficulty = require 'modules.difficulty_vote_by_amount'
-
-local Public = {}
-
-Public.events = {breached_wall = Event.generate_event_name('breached_wall')}
+local Public = require 'maps.mountain_fortress_v3.table'
 
 function Public.init_enemy_weapon_damage()
     local data = {
@@ -34,7 +30,7 @@ function Public.init_enemy_weapon_damage()
     end
 end
 
-local function enemy_weapon_damage()
+function Public.enemy_weapon_damage()
     local e = game.forces.enemy
 
     local data = {
@@ -59,6 +55,4 @@ local function enemy_weapon_damage()
     end
 end
 
-Event.add(Public.events.breached_wall, enemy_weapon_damage)
-
 return Public
diff --git a/maps/mountain_fortress_v3/basic_markets.lua b/maps/mountain_fortress_v3/basic_markets.lua
index f9759a5f..2c5e1548 100644
--- a/maps/mountain_fortress_v3/basic_markets.lua
+++ b/maps/mountain_fortress_v3/basic_markets.lua
@@ -1,4 +1,5 @@
 local Global = require 'utils.global'
+local Public = require 'maps.mountain_fortress_v3.table'
 
 local this = {
     market_settings = {
@@ -143,8 +144,6 @@ Global.register(
     end
 )
 
-local Public = {}
-
 local random = math.random
 local floor = math.floor
 
@@ -329,35 +328,4 @@ function Public.shuffle_prices()
     end
 end
 
-function Public.get(key)
-    if key then
-        return this[key]
-    else
-        return this
-    end
-end
-
-function Public.set(key, value)
-    if key and (value or value == false) then
-        this[key] = value
-        return this[key]
-    elseif key then
-        return this[key]
-    else
-        return this
-    end
-end
-
-function Public.remove(key, sub_key)
-    if key and sub_key then
-        if this[key] and this[key][sub_key] then
-            this[key][sub_key] = nil
-        end
-    elseif key then
-        if this[key] then
-            this[key] = nil
-        end
-    end
-end
-
 return Public
diff --git a/maps/mountain_fortress_v3/biters_yield_coins.lua b/maps/mountain_fortress_v3/biters_yield_coins.lua
index f9f6b3ab..d0ab457e 100644
--- a/maps/mountain_fortress_v3/biters_yield_coins.lua
+++ b/maps/mountain_fortress_v3/biters_yield_coins.lua
@@ -1,4 +1,5 @@
 local Event = require 'utils.event'
+local Public = require 'maps.mountain_fortress_v3.table'
 local RPG = require 'modules.rpg.main'
 local BiterHealthBooster = require 'modules.biter_health_booster_v2'
 local insert = table.insert
@@ -137,3 +138,5 @@ local function on_entity_died(event)
 end
 
 Event.add(defines.events.on_entity_died, on_entity_died)
+
+return Public
diff --git a/maps/mountain_fortress_v3/breached_wall.lua b/maps/mountain_fortress_v3/breached_wall.lua
index 9541ef2e..629e968e 100644
--- a/maps/mountain_fortress_v3/breached_wall.lua
+++ b/maps/mountain_fortress_v3/breached_wall.lua
@@ -1,40 +1,37 @@
-local Collapse = require 'modules.collapse'
-local Balance = require 'maps.mountain_fortress_v3.balance'
-local RPG = require 'modules.rpg.main'
-local WPT = require 'maps.mountain_fortress_v3.table'
-local Alert = require 'utils.alert'
 local Event = require 'utils.event'
+local Public = require 'maps.mountain_fortress_v3.table'
+local Collapse = require 'modules.collapse'
+local RPG = require 'modules.rpg.main'
+local Alert = require 'utils.alert'
 local Task = require 'utils.task'
 local Token = require 'utils.token'
 local Color = require 'utils.color_presets'
-local BasicMarkets = require 'maps.mountain_fortress_v3.basic_markets'
 
-local raise_event = script.raise_event
 local floor = math.floor
 local abs = math.abs
 local random = math.random
 local sub = string.sub
 local sqrt = math.sqrt
-local zone_settings = WPT.zone_settings
+local zone_settings = Public.zone_settings
 
 local clear_breach_text_and_render = function()
-    local beam1 = WPT.get('zone1_beam1')
+    local beam1 = Public.get('zone1_beam1')
     if beam1 and beam1.valid then
         beam1.destroy()
     end
-    local beam2 = WPT.get('zone1_beam2')
+    local beam2 = Public.get('zone1_beam2')
     if beam2 and beam2.valid then
         beam2.destroy()
     end
-    local zone1_text1 = WPT.get('zone1_text1')
+    local zone1_text1 = Public.get('zone1_text1')
     if zone1_text1 then
         rendering.set_text(zone1_text1, 'Collapse has started!')
     end
-    local zone1_text2 = WPT.get('zone1_text2')
+    local zone1_text2 = Public.get('zone1_text2')
     if zone1_text2 then
         rendering.set_text(zone1_text2, 'Collapse has started!')
     end
-    local zone1_text3 = WPT.get('zone1_text3')
+    local zone1_text3 = Public.get('zone1_text3')
     if zone1_text3 then
         rendering.set_text(zone1_text3, 'Collapse has started!')
     end
@@ -70,7 +67,7 @@ local first_player_to_zone =
         local breached_wall = data.breached_wall
         local message = ({'breached_wall.first_to_reach', player.name, breached_wall})
         Alert.alert_all_players(10, message)
-        BasicMarkets.shuffle_prices()
+        Public.shuffle_prices()
     end
 )
 
@@ -94,19 +91,19 @@ local spidertron_too_far =
 local check_distance_between_player_and_locomotive = function(player)
     local surface = player.surface
     local position = player.position
-    local locomotive = WPT.get('locomotive')
+    local locomotive = Public.get('locomotive')
     if not locomotive or not locomotive.valid then
         return
     end
 
-    local gap_between_locomotive = WPT.get('gap_between_locomotive')
+    local gap_between_locomotive = Public.get('gap_between_locomotive')
 
     if not gap_between_locomotive.highest_pos then
         gap_between_locomotive.highest_pos = locomotive.position
     end
 
     gap_between_locomotive.highest_pos = locomotive.position
-    gap_between_locomotive = WPT.get('gap_between_locomotive')
+    gap_between_locomotive = Public.get('gap_between_locomotive')
 
     local c_y = position.y
     local t_y = gap_between_locomotive.highest_pos.y
@@ -127,7 +124,7 @@ end
 local compare_player_pos = function(player)
     local p = player.position
     local index = player.index
-    local adjusted_zones = WPT.get('adjusted_zones')
+    local adjusted_zones = Public.get('adjusted_zones')
     if not adjusted_zones.size then
         return
     end
@@ -166,14 +163,14 @@ local compare_player_and_train = function(player, entity)
     end
 
     local position = player.position
-    local locomotive = WPT.get('locomotive')
+    local locomotive = Public.get('locomotive')
     if not locomotive or not locomotive.valid then
         return
     end
 
-    local gap_between_zones = WPT.get('gap_between_zones')
+    local gap_between_zones = Public.get('gap_between_zones')
     gap_between_zones.highest_pos = locomotive.position
-    gap_between_zones = WPT.get('gap_between_zones')
+    gap_between_zones = Public.get('gap_between_zones')
 
     local c_y = position.y
     local t_y = gap_between_zones.highest_pos.y
@@ -207,13 +204,13 @@ local function distance(player)
     local index = player.index
     local bonus = RPG.get_value_from_player(index, 'bonus')
     local rpg_extra = RPG.get('rpg_extra')
-    local breached_wall = WPT.get('breached_wall')
-    local bonus_xp_on_join = WPT.get('bonus_xp_on_join')
-    local enable_arties = WPT.get('enable_arties')
+    local breached_wall = Public.get('breached_wall')
+    local bonus_xp_on_join = Public.get('bonus_xp_on_join')
+    local enable_arties = Public.get('enable_arties')
 
     local p = player.position
 
-    local validate_spider = WPT.get('validate_spider')
+    local validate_spider = Public.get('validate_spider')
     if validate_spider[index] then
         local e = validate_spider[index]
         if not (e and e.valid) then
@@ -236,16 +233,16 @@ local function distance(player)
     local max_times = location >= max
     if max_times then
         if breach_max_times then
-            local placed_trains_in_zone = WPT.get('placed_trains_in_zone')
-            local biters = WPT.get('biters')
+            local placed_trains_in_zone = Public.get('placed_trains_in_zone')
+            local biters = Public.get('biters')
             rpg_extra.breached_walls = rpg_extra.breached_walls + 1
             rpg_extra.reward_new_players = bonus_xp_on_join * rpg_extra.breached_walls
-            WPT.set('breached_wall', breached_wall + 1)
+            Public.set('breached_wall', breached_wall + 1)
             biters.amount = 0
             placed_trains_in_zone.randomized = false
-            raise_event(Balance.events.breached_wall, {})
-            if WPT.get('breached_wall') == WPT.get('spidertron_unlocked_at_zone') then
-                local main_market_items = WPT.get('main_market_items')
+            Public.enemy_weapon_damage()
+            if Public.get('breached_wall') == Public.get('spidertron_unlocked_at_zone') then
+                local main_market_items = Public.get('main_market_items')
                 if not main_market_items['spidertron'] then
                     local rng = random(70000, 120000)
                     main_market_items['spidertron'] = {
@@ -297,6 +294,9 @@ local function on_player_changed_position(event)
     if not player or not player.valid then
         return
     end
+    if player.controller_type == defines.controllers.spectator then
+        return
+    end
     local surface_name = player.surface.name
     local map_name = 'mtn_v3'
 
@@ -322,7 +322,7 @@ local function on_player_driving_changed_state(event)
     if not (entity and entity.valid) then
         return
     end
-    local s = WPT.get('validate_spider')
+    local s = Public.get('validate_spider')
     if entity.name == 'spidertron' then
         if not s[player.index] then
             s[player.index] = entity
@@ -336,3 +336,5 @@ end
 
 Event.add(defines.events.on_player_changed_position, on_player_changed_position)
 Event.add(defines.events.on_player_driving_changed_state, on_player_driving_changed_state)
+
+return Public
diff --git a/maps/mountain_fortress_v3/buried_enemies.lua b/maps/mountain_fortress_v3/buried_enemies.lua
index 25942867..492fdeb2 100644
--- a/maps/mountain_fortress_v3/buried_enemies.lua
+++ b/maps/mountain_fortress_v3/buried_enemies.lua
@@ -1,8 +1,8 @@
 local Event = require 'utils.event'
+local Public = require 'maps.mountain_fortress_v3.table'
 local Global = require 'utils.global'
 local BiterHealthBooster = require 'modules.biter_health_booster_v2'
 local WD = require 'modules.wave_defense.table'
-local WPT = require 'maps.mountain_fortress_v3.table'
 
 local this = {}
 
@@ -13,7 +13,6 @@ Global.register(
     end
 )
 
-local Public = {}
 local round = math.round
 local floor = math.floor
 local random = math.random
@@ -66,7 +65,7 @@ local function spawn_biters(data)
     local position = data.position
     local h = floor(abs(position.y))
 
-    local max_biters = WPT.get('biters')
+    local max_biters = Public.get('biters')
 
     if max_biters.amount >= max_biters.limit then
         return false
@@ -116,7 +115,7 @@ end
 local function spawn_worms(data)
     local modified_unit_health = WD.get('modified_unit_health')
     local modified_boss_unit_health = WD.get('modified_boss_unit_health')
-    local max_biters = WPT.get('biters')
+    local max_biters = Public.get('biters')
 
     if max_biters.amount >= max_biters.limit then
         return
@@ -237,7 +236,7 @@ local function on_tick()
     this[t] = nil
 end
 
-function Public.reset()
+function Public.reset_buried_biters()
     for k, _ in pairs(this) do
         this[k] = nil
     end
diff --git a/maps/mountain_fortress_v3/commands.lua b/maps/mountain_fortress_v3/commands.lua
index 3868e9ee..1fbc1bf8 100644
--- a/maps/mountain_fortress_v3/commands.lua
+++ b/maps/mountain_fortress_v3/commands.lua
@@ -1,7 +1,7 @@
 local Color = require 'utils.color_presets'
+local Public = require 'maps.mountain_fortress_v3.table'
 local Task = require 'utils.task'
 local Server = require 'utils.server'
-local WPT = require 'maps.mountain_fortress_v3.table'
 local Collapse = require 'modules.collapse'
 local WD = require 'modules.wave_defense.table'
 
@@ -23,8 +23,7 @@ commands.add_command(
             end
         end
 
-        local this = WPT.get()
-        local reset_map = require 'maps.mountain_fortress_v3.main'.reset_map
+        local this = Public.get()
         local param = cmd.parameter
 
         if param == 'restart' or param == 'shutdown' or param == 'reset' or param == 'restartnow' then
@@ -87,7 +86,7 @@ commands.add_command(
             else
                 game.print(mapkeeper .. ' server, has reset the game!', {r = 0.98, g = 0.66, b = 0.22})
             end
-            reset_map()
+            Public.reset_map()
             p('[WARNING] Game has been reset!')
             return
         end
@@ -135,7 +134,7 @@ commands.add_command(
             return
         end
 
-        local this = WPT.get()
+        local this = Public.get()
         local tbl = WD.get()
 
         if not this.disable_biters_are_you_sure then
@@ -170,7 +169,7 @@ commands.add_command(
             return
         end
 
-        local this = WPT.get()
+        local this = Public.get()
 
         if not this.orbital_strikes_are_you_sure then
             this.orbital_strikes_are_you_sure = true
@@ -240,3 +239,5 @@ if _DEBUG then
         end
     )
 end
+
+return Public
diff --git a/maps/mountain_fortress_v3/core.lua b/maps/mountain_fortress_v3/core.lua
new file mode 100644
index 00000000..fbabdbfb
--- /dev/null
+++ b/maps/mountain_fortress_v3/core.lua
@@ -0,0 +1,32 @@
+local Public = require 'maps.mountain_fortress_v3.table'
+
+Public.balance = require 'maps.mountain_fortress_v3.balance'
+Public.basic_markets = require 'maps.mountain_fortress_v3.basic_markets'
+Public.biters_yield_coins = require 'maps.mountain_fortress_v3.biters_yield_coins'
+Public.breached_wall = require 'maps.mountain_fortress_v3.breached_wall'
+Public.buried_enemies = require 'maps.mountain_fortress_v3.buried_enemies'
+Public.commands = require 'maps.mountain_fortress_v3.commands'
+Public.entities = require 'maps.mountain_fortress_v3.entities'
+Public.functions = require 'maps.mountain_fortress_v3.functions'
+Public.terrain = require 'maps.mountain_fortress_v3.terrain'
+Public.generate = require 'maps.mountain_fortress_v3.generate'
+Public.get_perlin = require 'maps.mountain_fortress_v3.get_perlin'
+Public.gui = require 'maps.mountain_fortress_v3.gui'
+-- Public.highscore = require 'maps.mountain_fortress_v3.highscore'
+Public.locomotive = require 'maps.mountain_fortress_v3.locomotive'
+Public.loot = require 'maps.mountain_fortress_v3.loot'
+Public.mining = require 'maps.mountain_fortress_v3.mining'
+Public.mystical_chest = require 'maps.mountain_fortress_v3.mystical_chest'
+Public.resource_generator = require 'maps.mountain_fortress_v3.resource_generator'
+Public.rocks_yield_ore_veins = require 'maps.mountain_fortress_v3.rocks_yield_ore_veins'
+Public.soft_reset = require 'maps.mountain_fortress_v3.soft_reset'
+Public.surface = require 'maps.mountain_fortress_v3.surface'
+Public.traps = require 'maps.mountain_fortress_v3.traps'
+Public.defense_system = require 'maps.mountain_fortress_v3.locomotive.defense_system'
+Public.friendly_pet = require 'maps.mountain_fortress_v3.locomotive.friendly_pet'
+Public.linked_chests = require 'maps.mountain_fortress_v3.locomotive.linked_chests'
+Public.market = require 'maps.mountain_fortress_v3.locomotive.market'
+Public.permission_groups = require 'maps.mountain_fortress_v3.locomotive.permission_groups'
+Public.spawn_locomotive = require 'maps.mountain_fortress_v3.locomotive.spawn_locomotive'
+
+return Public
diff --git a/maps/mountain_fortress_v3/entities.lua b/maps/mountain_fortress_v3/entities.lua
index 8776e32c..9ade180e 100644
--- a/maps/mountain_fortress_v3/entities.lua
+++ b/maps/mountain_fortress_v3/entities.lua
@@ -1,39 +1,26 @@
 require 'modules.rocks_broken_paint_tiles'
 
 local Event = require 'utils.event'
+local Public = require 'maps.mountain_fortress_v3.table'
 local Server = require 'utils.server'
-local BuriedEnemies = require 'maps.mountain_fortress_v3.buried_enemies'
-local Loot = require 'maps.mountain_fortress_v3.loot'
 local RPG = require 'modules.rpg.main'
-local Callbacks = require 'maps.mountain_fortress_v3.functions'
-local Mining = require 'maps.mountain_fortress_v3.mining'
-local Traps = require 'maps.mountain_fortress_v3.traps'
-local Locomotive = require 'maps.mountain_fortress_v3.locomotive'
-local DefenseSystem = require 'maps.mountain_fortress_v3.locomotive.defense_system'
 local Collapse = require 'modules.collapse'
 local Alert = require 'utils.alert'
 local Task = require 'utils.task'
 local Score = require 'utils.gui.score'
 local Token = require 'utils.token'
--- local HS = require 'maps.mountain_fortress_v3.highscore'
 local Discord = require 'utils.discord'
 local Core = require 'utils.core'
 local Diff = require 'modules.difficulty_vote_by_amount'
 local format_number = require 'util'.format_number
 local RPG_Progression = require 'utils.datastore.rpg_data'
-
--- tables
-local WPT = require 'maps.mountain_fortress_v3.table'
 local WD = require 'modules.wave_defense.table'
-local zone_settings = WPT.zone_settings
 
--- module
-local Public = {}
+local zone_settings = Public.zone_settings
 local random = math.random
 local floor = math.floor
 local abs = math.abs
 local round = math.round
-local raise_event = script.raise_event
 
 -- Use these settings for live
 local send_ping_to_channel = Discord.channel_names.mtn_channel
@@ -98,20 +85,20 @@ local reset_game =
     function(data)
         local this = data.this
         if this.soft_reset then
-            -- HS.set_scores()
+            -- Public.set_scores()
             this.game_reset_tick = nil
-            raise_event(WPT.events.reset_map, {})
+            Public.reset_map()
             return
         end
         if this.restart then
-            -- HS.set_scores()
+            -- Public.set_scores()
             local message = ({'entity.reset_game'})
             Server.to_discord_bold(message, true)
             Server.start_scenario('Mountain_Fortress_v3')
             return
         end
         if this.shutdown then
-            -- HS.set_scores()
+            -- Public.set_scores()
             local message = ({'entity.shutdown_game'})
             Server.to_discord_bold(message, true)
             Server.stop_scenario()
@@ -141,7 +128,7 @@ end
 
 local function on_entity_removed(data)
     local entity = data.entity
-    local upgrades = WPT.get('upgrades')
+    local upgrades = Public.get('upgrades')
 
     local built = {
         ['land-mine'] = upgrades.landmine.built,
@@ -164,11 +151,11 @@ local function on_entity_removed(data)
 end
 
 local function check_health()
-    local locomotive_health = WPT.get('locomotive_health')
-    local locomotive_max_health = WPT.get('locomotive_max_health')
-    local carriages = WPT.get('carriages')
+    local locomotive_health = Public.get('locomotive_health')
+    local locomotive_max_health = Public.get('locomotive_max_health')
+    local carriages = Public.get('carriages')
     if locomotive_health <= 0 then
-        WPT.set('locomotive_health', 0)
+        Public.set('locomotive_health', 0)
     end
     local m = locomotive_health / locomotive_max_health
     if carriages then
@@ -188,7 +175,7 @@ local function check_health()
 end
 
 local function check_health_final_damage(final_damage_amount)
-    local carriages = WPT.get('carriages')
+    local carriages = Public.get('carriages')
     if carriages then
         for i = 1, #carriages do
             local entity = carriages[i]
@@ -205,17 +192,17 @@ local function set_train_final_health(final_damage_amount, repair)
         return
     end
 
-    local locomotive = WPT.get('locomotive')
+    local locomotive = Public.get('locomotive')
     if not (locomotive and locomotive.valid) then
         return
     end
 
-    local locomotive_health = WPT.get('locomotive_health')
-    local locomotive_max_health = WPT.get('locomotive_max_health')
+    local locomotive_health = Public.get('locomotive_health')
+    local locomotive_max_health = Public.get('locomotive_max_health')
 
     if not repair then
-        local poison_deployed = WPT.get('poison_deployed')
-        local robotics_deployed = WPT.get('robotics_deployed')
+        local poison_deployed = Public.get('poison_deployed')
+        local robotics_deployed = Public.get('robotics_deployed')
 
         local lower_high = locomotive_max_health * 0.4
         local higher_high = locomotive_max_health * 0.5
@@ -224,12 +211,12 @@ local function set_train_final_health(final_damage_amount, repair)
 
         if locomotive_health >= lower_high and locomotive_health <= higher_high then
             if not poison_deployed then
-                local carriages = WPT.get('carriages')
+                local carriages = Public.get('carriages')
 
                 if carriages then
                     for i = 1, #carriages do
                         local entity = carriages[i]
-                        DefenseSystem.enable_poison_defense(entity.position)
+                        Public.enable_poison_defense(entity.position)
                     end
                 end
 
@@ -238,16 +225,16 @@ local function set_train_final_health(final_damage_amount, repair)
                 }
                 local msg = ({'entity.train_taking_damage'})
                 Alert.alert_all_players_location(p, msg)
-                WPT.set().poison_deployed = true
+                Public.set().poison_deployed = true
             end
         elseif locomotive_health >= lower_low and locomotive_health <= higher_low then
             if not robotics_deployed then
-                local carriages = WPT.get('carriages')
+                local carriages = Public.get('carriages')
 
                 if carriages then
                     for i = 1, #carriages do
                         local entity = carriages[i]
-                        DefenseSystem.enable_robotic_defense(entity.position)
+                        Public.enable_robotic_defense(entity.position)
                     end
                 end
                 local p = {
@@ -255,17 +242,17 @@ local function set_train_final_health(final_damage_amount, repair)
                 }
                 local msg = ({'entity.train_taking_damage'})
                 Alert.alert_all_players_location(p, msg)
-                WPT.set().robotics_deployed = true
+                Public.set().robotics_deployed = true
             end
         elseif locomotive_health >= locomotive_max_health then
-            WPT.set().poison_deployed = false
+            Public.set().poison_deployed = false
         end
     end
 
     if locomotive_health <= 0 or locomotive.health <= 5 then
         locomotive.destructible = false
         locomotive.health = 1
-        WPT.set('game_lost', true)
+        Public.set('game_lost', true)
         Public.loco_died()
     end
 
@@ -274,15 +261,15 @@ local function set_train_final_health(final_damage_amount, repair)
         return
     end
 
-    WPT.set('locomotive_health', floor(locomotive_health - final_damage_amount))
+    Public.set('locomotive_health', floor(locomotive_health - final_damage_amount))
     if locomotive_health > locomotive_max_health then
-        WPT.set('locomotive_health', locomotive_max_health)
+        Public.set('locomotive_health', locomotive_max_health)
     end
-    locomotive_health = WPT.get('locomotive_health')
+    locomotive_health = Public.get('locomotive_health')
 
     check_health()
 
-    local health_text = WPT.get('health_text')
+    local health_text = Public.get('health_text')
 
     rendering.set_text(health_text, 'HP: ' .. round(locomotive_health) .. ' / ' .. round(locomotive_max_health))
 end
@@ -297,7 +284,7 @@ local function protect_entities(data)
         return
     end
 
-    local check_heavy_damage = WPT.get('check_heavy_damage')
+    local check_heavy_damage = Public.get('check_heavy_damage')
 
     if check_heavy_damage then
         if entity.type == 'simple-entity' and dmg >= 500 then
@@ -321,7 +308,7 @@ local function protect_entities(data)
         return false
     end
 
-    local carriages_numbers = WPT.get('carriages_numbers')
+    local carriages_numbers = Public.get('carriages_numbers')
     if is_protected(entity) then
         if (cause and cause.valid) then
             if cause.force.index == 2 then
@@ -360,12 +347,12 @@ local function hidden_treasure(player, entity)
     if magic >= 50 then
         local msg = rare_treasure_chest_messages[random(1, #rare_treasure_chest_messages)]
         Alert.alert_player(player, 5, msg)
-        Loot.add_rare(entity.surface, entity.position, 'wooden-chest', magic)
+        Public.add_loot_rare(entity.surface, entity.position, 'wooden-chest', magic)
         return
     end
     local msg = treasure_chest_messages[random(1, #treasure_chest_messages)]
     Alert.alert_player(player, 5, msg, nil, nil, 0.3)
-    Loot.add(entity.surface, entity.position, chests[random(1, size_chests)])
+    Public.add_loot(entity.surface, entity.position, chests[random(1, size_chests)])
 end
 
 local function biters_chew_rocks_faster(data)
@@ -400,10 +387,10 @@ local function angry_tree(entity, cause, player)
         return
     end
     if random(1, 6) == 1 then
-        BuriedEnemies.buried_biter(entity.surface, entity.position)
+        Public.buried_biter(entity.surface, entity.position)
     end
     if random(1, 8) == 1 then
-        BuriedEnemies.buried_worm(entity.surface, entity.position)
+        Public.buried_worm(entity.surface, entity.position)
     end
     if random(1, 32) ~= 1 then
         return
@@ -420,8 +407,8 @@ local function angry_tree(entity, cause, player)
     if player then
         local forest_zone = RPG.get_value_from_player(player.index, 'forest_zone')
         if forest_zone and random(1, 32) == 1 then
-            local cbl = Callbacks.refill_turret_callback
-            local data = {callback_data = Callbacks.piercing_rounds_magazine_ammo}
+            local cbl = Public.refill_turret_callback
+            local data = {callback_data = Public.piercing_rounds_magazine_ammo}
             local e =
                 entity.surface.create_entity(
                 {
@@ -430,8 +417,8 @@ local function angry_tree(entity, cause, player)
                     force = 'enemy'
                 }
             )
-            if e.can_insert(Callbacks.piercing_rounds_magazine_ammo) then
-                e.insert(Callbacks.piercing_rounds_magazine_ammo)
+            if e.can_insert(Public.piercing_rounds_magazine_ammo) then
+                e.insert(Public.piercing_rounds_magazine_ammo)
             end
             local callback = Token.get(cbl)
             callback(e, data)
@@ -453,8 +440,8 @@ local function angry_tree(entity, cause, player)
 end
 
 local function give_coin(player)
-    local coin_amount = WPT.get('coin_amount')
-    local coin_override = WPT.get('coin_override')
+    local coin_amount = Public.get('coin_amount')
+    local coin_override = Public.get('coin_override')
     local forest_zone = RPG.get_value_from_player(player.index, 'forest_zone')
 
     if forest_zone then
@@ -504,12 +491,12 @@ local mining_events = {
     },
     {
         function(entity)
-            if Locomotive.is_around_train(entity) then
+            if Public.is_around_train(entity) then
                 entity.destroy()
                 return
             end
 
-            BuriedEnemies.buried_biter(entity.surface, entity.position)
+            Public.buried_biter(entity.surface, entity.position)
             entity.destroy()
         end,
         4096,
@@ -517,12 +504,12 @@ local mining_events = {
     },
     {
         function(entity)
-            if Locomotive.is_around_train(entity) then
+            if Public.is_around_train(entity) then
                 entity.destroy()
                 return
             end
 
-            BuriedEnemies.buried_biter(entity.surface, entity.position)
+            Public.buried_biter(entity.surface, entity.position)
             entity.destroy()
         end,
         512,
@@ -530,12 +517,12 @@ local mining_events = {
     },
     {
         function(entity)
-            if Locomotive.is_around_train(entity) then
+            if Public.is_around_train(entity) then
                 entity.destroy()
                 return
             end
 
-            BuriedEnemies.buried_worm(entity.surface, entity.position)
+            Public.buried_worm(entity.surface, entity.position)
             entity.destroy()
         end,
         2048,
@@ -543,12 +530,12 @@ local mining_events = {
     },
     {
         function(entity)
-            if Locomotive.is_around_train(entity) then
+            if Public.is_around_train(entity) then
                 entity.destroy()
                 return
             end
 
-            Traps(entity.surface, entity.position)
+            Public.tick_tack_trap(entity.surface, entity.position)
             entity.destroy()
         end,
         2048,
@@ -556,7 +543,7 @@ local mining_events = {
     },
     {
         function(entity, index)
-            if Locomotive.is_around_train(entity) then
+            if Public.is_around_train(entity) then
                 entity.destroy()
                 return
             end
@@ -629,7 +616,7 @@ local mining_events = {
     },
     {
         function(entity, index)
-            if Locomotive.is_around_train(entity) then
+            if Public.is_around_train(entity) then
                 entity.destroy()
                 return
             end
@@ -649,7 +636,7 @@ local mining_events = {
     },
     {
         function(entity, index)
-            if Locomotive.is_around_train(entity) then
+            if Public.is_around_train(entity) then
                 entity.destroy()
                 return
             end
@@ -678,7 +665,7 @@ local mining_events = {
     },
     {
         function(entity)
-            if Locomotive.is_around_train(entity) then
+            if Public.is_around_train(entity) then
                 entity.destroy()
                 return
             end
@@ -744,11 +731,11 @@ local function on_player_mined_entity(event)
         return
     end
 
-    local mined_scrap = WPT.get('mined_scrap')
+    local mined_scrap = Public.get('mined_scrap')
 
     if entity.type == 'simple-entity' or entity.type == 'simple-entity-with-owner' or entity.type == 'tree' then
-        WPT.set().mined_scrap = mined_scrap + 1
-        Mining.on_player_mined_entity(event)
+        Public.set().mined_scrap = mined_scrap + 1
+        Public.on_player_mined_entity(event)
         if entity.type == 'tree' then
             if random(1, 3) == 1 then
                 give_coin(player)
@@ -912,7 +899,7 @@ local function on_entity_damaged(event)
 
     local wave_number = WD.get_wave()
     local boss_wave_warning = WD.get_alert_boss_wave()
-    local munch_time = WPT.get('munch_time')
+    local munch_time = Public.get('munch_time')
 
     local data = {
         cause = cause,
@@ -945,7 +932,7 @@ local function on_player_repaired_entity(event)
         return
     end
     local entity = event.entity
-    local carriages_numbers = WPT.get('carriages_numbers')
+    local carriages_numbers = Public.get('carriages_numbers')
 
     if carriages_numbers[entity.unit_number] then
         local player = game.get_player(event.player_index)
@@ -998,20 +985,20 @@ local function on_entity_died(event)
         return
     end
 
-    local biters_killed = WPT.get('biters_killed')
-    local biters = WPT.get('biters')
+    local biters_killed = Public.get('biters_killed')
+    local biters = Public.get('biters')
 
     if entity.type == 'unit' or entity.type == 'unit-spawner' then
-        WPT.set().biters_killed = biters_killed + 1
+        Public.set().biters_killed = biters_killed + 1
         biters.amount = biters.amount - 1
         if biters.amount <= 0 then
             biters.amount = 0
         end
-        if Locomotive.is_around_train(entity) then
+        if Public.is_around_train(entity) then
             return
         end
         if random(1, 512) == 1 then
-            Traps(entity.surface, entity.position)
+            Public.tick_tack_trap(entity.surface, entity.position)
             return
         end
     end
@@ -1033,7 +1020,7 @@ local function on_entity_died(event)
                 return
             end
         end
-        if Locomotive.is_around_train(entity) then
+        if Public.is_around_train(entity) then
             return
         end
         angry_tree(entity, cause, player)
@@ -1041,22 +1028,22 @@ local function on_entity_died(event)
     end
 
     if entity.type == 'simple-entity' then
-        if Locomotive.is_around_train(entity) then
+        if Public.is_around_train(entity) then
             entity.destroy()
             return
         end
         if random(1, 32) == 1 then
-            BuriedEnemies.buried_biter(entity.surface, entity.position)
+            Public.buried_biter(entity.surface, entity.position)
             entity.destroy()
             return
         end
         if random(1, 64) == 1 then
-            BuriedEnemies.buried_worm(entity.surface, entity.position)
+            Public.buried_worm(entity.surface, entity.position)
             entity.destroy()
             return
         end
         if random(1, 512) == 1 then
-            Traps(entity.surface, entity.position)
+            Public.tick_tack_trap(entity.surface, entity.position)
             return
         end
         entity.destroy()
@@ -1159,7 +1146,7 @@ local function show_mvps(player)
         miners_label_text.style.font = 'default-bold'
         miners_label_text.style.font_color = {r = 0.33, g = 0.66, b = 0.9}
 
-        local sent_to_discord = WPT.get('sent_to_discord')
+        local sent_to_discord = Public.get('sent_to_discord')
 
         if not sent_to_discord then
             local message = {
@@ -1199,12 +1186,12 @@ local function show_mvps(player)
             end
             local time_played = Core.format_time(game.ticks_played)
             local total_players = #game.players
-            local pickaxe_upgrades = WPT.pickaxe_upgrades
-            local upgrades = WPT.get('upgrades')
+            local pickaxe_upgrades = Public.pickaxe_upgrades
+            local upgrades = Public.get('upgrades')
             local pick_tier = pickaxe_upgrades[upgrades.pickaxe_tier]
 
             local server_name_matches = Server.check_server_name('Mtn Fortress')
-            if WPT.get('prestige_system_enabled') then
+            if Public.get('prestige_system_enabled') then
                 RPG_Progression.save_all_players()
             end
             local date = Server.get_start_time()
@@ -1270,7 +1257,7 @@ local function show_mvps(player)
                 Server.to_discord_embed_parsed(text)
             end
 
-            WPT.set('sent_to_discord', true)
+            Public.set('sent_to_discord', true)
         end
     end
 end
@@ -1284,19 +1271,20 @@ function Public.unstuck_player(index)
     end
     player.teleport(position, surface)
 end
+
 function Public.loco_died(invalid_locomotive)
-    local game_lost = WPT.get('game_lost')
+    local game_lost = Public.get('game_lost')
     if not game_lost then
         return
     end
 
-    local announced_message = WPT.get('announced_message')
+    local announced_message = Public.get('announced_message')
     if announced_message then
         return
     end
 
-    local active_surface_index = WPT.get('active_surface_index')
-    local locomotive = WPT.get('locomotive')
+    local active_surface_index = Public.get('active_surface_index')
+    local locomotive = Public.get('locomotive')
     local surface = game.surfaces[active_surface_index]
     local wave_defense_table = WD.get_table()
     if wave_defense_table.game_lost and not invalid_locomotive then
@@ -1310,7 +1298,7 @@ function Public.loco_died(invalid_locomotive)
     end
 
     if not locomotive.valid then
-        local this = WPT.get()
+        local this = Public.get()
 
         local data = {}
         if this.locomotive and this.locomotive.valid then
@@ -1351,7 +1339,7 @@ function Public.loco_died(invalid_locomotive)
         return
     end
 
-    local this = WPT.get()
+    local this = Public.get()
 
     this.locomotive_health = 0
     this.locomotive.color = {0.49, 0, 255, 1}
@@ -1430,7 +1418,7 @@ local function on_built_entity(event)
         return
     end
 
-    local upgrades = WPT.get('upgrades')
+    local upgrades = Public.get('upgrades')
 
     local upg = upgrades
     local surface = entity.surface
@@ -1526,7 +1514,7 @@ local function on_robot_built_entity(event)
         return
     end
 
-    local upgrades = WPT.get('upgrades')
+    local upgrades = Public.get('upgrades')
 
     local upg = upgrades
     local surface = entity.surface
diff --git a/maps/mountain_fortress_v3/functions.lua b/maps/mountain_fortress_v3/functions.lua
index 8e16154b..da0adc6b 100644
--- a/maps/mountain_fortress_v3/functions.lua
+++ b/maps/mountain_fortress_v3/functions.lua
@@ -1,12 +1,12 @@
+local Event = require 'utils.event'
+local Public = require 'maps.mountain_fortress_v3.table'
 local Server = require 'utils.server'
 local Token = require 'utils.token'
 local Task = require 'utils.task'
 local Color = require 'utils.color_presets'
 local ICW = require 'maps.mountain_fortress_v3.icw.main'
-local Event = require 'utils.event'
 local Global = require 'utils.global'
 local Alert = require 'utils.alert'
-local WPT = require 'maps.mountain_fortress_v3.table'
 local WD = require 'modules.wave_defense.table'
 local RPG = require 'modules.rpg.main'
 local Collapse = require 'modules.collapse'
@@ -16,7 +16,9 @@ local math2d = require 'math2d'
 local Misc = require 'utils.commands.misc'
 local Core = require 'utils.core'
 local Beams = require 'modules.render_beam'
-local zone_settings = WPT.zone_settings
+local BottomFrame = require 'utils.gui.bottom_frame'
+
+local zone_settings = Public.zone_settings
 
 local this = {
     power_sources = {index = 1},
@@ -69,8 +71,6 @@ Global.register(
     end
 )
 
-local Public = {}
-
 local random = math.random
 local floor = math.floor
 local round = math.round
@@ -100,7 +100,7 @@ local artillery_target_entities = {
 }
 
 local function debug_str(msg)
-    local debug = WPT.get('debug')
+    local debug = Public.get('debug')
     if not debug then
         return
     end
@@ -296,7 +296,7 @@ local artillery_target_callback =
 )
 
 local function difficulty_and_adjust_prices()
-    local fixed_prices = WPT.get('marked_fixed_prices')
+    local fixed_prices = Public.get('marked_fixed_prices')
     local difficulty_index = Difficulty.get('index')
 
     for index, price in pairs(fixed_prices) do
@@ -310,7 +310,7 @@ end
 
 local function do_beams_away()
     local wave_number = WD.get_wave()
-    local orbital_strikes = WPT.get('orbital_strikes')
+    local orbital_strikes = Public.get('orbital_strikes')
     if not orbital_strikes.enabled then
         return
     end
@@ -327,7 +327,7 @@ local function do_beams_away()
         end
 
         if wave_number % wave_nth == 0 then
-            local active_surface_index = WPT.get('active_surface_index')
+            local active_surface_index = Public.get('active_surface_index')
             local surface = game.get_surface(active_surface_index)
 
             if not orbital_strikes[wave_number] then
@@ -751,7 +751,7 @@ end
 
 local function calc_players()
     local players = game.connected_players
-    local check_afk_players = WPT.get('check_afk_players')
+    local check_afk_players = Public.get('check_afk_players')
     if not check_afk_players then
         return #players
     end
@@ -849,7 +849,7 @@ local boost_movement_speed_on_respawn =
 )
 
 function Public.set_difficulty()
-    local game_lost = WPT.get('game_lost')
+    local game_lost = Public.get('game_lost')
     if game_lost then
         return
     end
@@ -858,13 +858,13 @@ function Public.set_difficulty()
         return
     end
     local wave_defense_table = WD.get_table()
-    local check_if_threat_below_zero = WPT.get('check_if_threat_below_zero')
-    local collapse_amount = WPT.get('collapse_amount')
-    local collapse_speed = WPT.get('collapse_speed')
-    local difficulty = WPT.get('difficulty')
-    local mining_bonus_till_wave = WPT.get('mining_bonus_till_wave')
-    local mining_bonus = WPT.get('mining_bonus')
-    local disable_mining_boost = WPT.get('disable_mining_boost')
+    local check_if_threat_below_zero = Public.get('check_if_threat_below_zero')
+    local collapse_amount = Public.get('collapse_amount')
+    local collapse_speed = Public.get('collapse_speed')
+    local difficulty = Public.get('difficulty')
+    local mining_bonus_till_wave = Public.get('mining_bonus_till_wave')
+    local mining_bonus = Public.get('mining_bonus')
+    local disable_mining_boost = Public.get('disable_mining_boost')
     local wave_number = WD.get_wave()
     local player_count = calc_players()
 
@@ -971,17 +971,17 @@ function Public.set_difficulty()
                 mining_bonus = 0 -- back to 0% with more than 11 players
             end
             force.manual_mining_speed_modifier = force.manual_mining_speed_modifier + mining_bonus
-            WPT.set('mining_bonus', mining_bonus) -- Setting mining_bonus globally so it remembers how much to reduce
+            Public.set('mining_bonus', mining_bonus) -- Setting mining_bonus globally so it remembers how much to reduce
         else
             force.manual_mining_speed_modifier = force.manual_mining_speed_modifier - mining_bonus
-            WPT.set('disable_mining_boost', true)
+            Public.set('disable_mining_boost', true)
         end
     end
 end
 
 function Public.render_direction(surface)
-    local counter = WPT.get('soft_reset_counter')
-    local winter_mode = WPT.get('winter_mode')
+    local counter = Public.get('soft_reset_counter')
+    local winter_mode = Public.get('winter_mode')
     local text = 'Welcome to Mountain Fortress v3!'
     if winter_mode then
         text = 'Welcome to Wintery Mountain Fortress v3!'
@@ -1081,12 +1081,12 @@ function Public.render_direction(surface)
 end
 
 function Public.boost_difficulty()
-    local difficulty_set = WPT.get('difficulty_set')
+    local difficulty_set = Public.get('difficulty_set')
     if difficulty_set then
         return
     end
 
-    local breached_wall = WPT.get('breached_wall')
+    local breached_wall = Public.get('breached_wall')
 
     local difficulty = Difficulty.get()
     if not difficulty then
@@ -1102,51 +1102,51 @@ function Public.boost_difficulty()
 
     local message = ({'main.diff_set', name})
     local data = {
-        position = WPT.get('locomotive').position
+        position = Public.get('locomotive').position
     }
     Alert.alert_all_players_location(data, message)
 
     local force = game.forces.player
 
-    local active_surface_index = WPT.get('active_surface_index')
+    local active_surface_index = Public.get('active_surface_index')
     local surface = game.get_surface(active_surface_index)
 
     if index == 1 then
         force.manual_mining_speed_modifier = force.manual_mining_speed_modifier + 0.5
         force.character_running_speed_modifier = 0.15
         force.manual_crafting_speed_modifier = 0.15
-        WPT.set('coin_amount', 1)
-        WPT.set('upgrades').flame_turret.limit = 12
-        WPT.set('upgrades').landmine.limit = 50
-        WPT.set('locomotive_health', 10000)
-        WPT.set('locomotive_max_health', 10000)
-        WPT.set('bonus_xp_on_join', 500)
+        Public.set('coin_amount', 1)
+        Public.set('upgrades').flame_turret.limit = 12
+        Public.set('upgrades').landmine.limit = 50
+        Public.set('locomotive_health', 10000)
+        Public.set('locomotive_max_health', 10000)
+        Public.set('bonus_xp_on_join', 500)
         WD.set('next_wave', game.tick + 3600 * 15)
-        WPT.set('spidertron_unlocked_at_zone', 10)
+        Public.set('spidertron_unlocked_at_zone', 10)
         WD.set_normal_unit_current_health(1.0)
         WD.set_unit_health_increment_per_wave(0.15)
         WD.set_boss_unit_current_health(2)
         WD.set_boss_health_increment_per_wave(1.5)
         WD.set('death_mode', false)
-        WPT.set('difficulty_set', true)
+        Public.set('difficulty_set', true)
     elseif index == 2 then
         force.manual_mining_speed_modifier = force.manual_mining_speed_modifier + 0.25
         force.character_running_speed_modifier = 0.1
         force.manual_crafting_speed_modifier = 0.1
-        WPT.set('coin_amount', 2)
-        WPT.set('upgrades').flame_turret.limit = 10
-        WPT.set('upgrades').landmine.limit = 50
-        WPT.set('locomotive_health', 7000)
-        WPT.set('locomotive_max_health', 7000)
-        WPT.set('bonus_xp_on_join', 300)
+        Public.set('coin_amount', 2)
+        Public.set('upgrades').flame_turret.limit = 10
+        Public.set('upgrades').landmine.limit = 50
+        Public.set('locomotive_health', 7000)
+        Public.set('locomotive_max_health', 7000)
+        Public.set('bonus_xp_on_join', 300)
         WD.set('next_wave', game.tick + 3600 * 8)
-        WPT.set('spidertron_unlocked_at_zone', 8)
+        Public.set('spidertron_unlocked_at_zone', 8)
         WD.set_normal_unit_current_health(1.4)
         WD.set_unit_health_increment_per_wave(0.3)
         WD.set_boss_unit_current_health(3)
         WD.set_boss_health_increment_per_wave(3)
         WD.set('death_mode', false)
-        WPT.set('difficulty_set', true)
+        Public.set('difficulty_set', true)
         local damage_warning = ({'main.damage_mode_warning'})
         Alert.alert_all_players_location(data, damage_warning)
         Core.iter_players(
@@ -1160,12 +1160,12 @@ function Public.boost_difficulty()
                 end
             end
         )
-        local upgrades = WPT.get('upgrades')
-        if WPT.get('circle') then
-            rendering.destroy(WPT.get('circle'))
+        local upgrades = Public.get('upgrades')
+        if Public.get('circle') then
+            rendering.destroy(Public.get('circle'))
         end
-        local locomotive = WPT.get('locomotive')
-        WPT.set(
+        local locomotive = Public.get('locomotive')
+        Public.set(
             'circle',
             rendering.draw_circle {
                 surface = active_surface_index,
@@ -1180,20 +1180,20 @@ function Public.boost_difficulty()
     elseif index == 3 then
         force.character_running_speed_modifier = 0
         force.manual_crafting_speed_modifier = 0
-        WPT.set('coin_amount', 4)
-        WPT.set('upgrades').flame_turret.limit = 3
-        WPT.set('upgrades').landmine.limit = 10
-        WPT.set('locomotive_health', 5000)
-        WPT.set('locomotive_max_health', 5000)
-        WPT.set('bonus_xp_on_join', 50)
+        Public.set('coin_amount', 4)
+        Public.set('upgrades').flame_turret.limit = 3
+        Public.set('upgrades').landmine.limit = 10
+        Public.set('locomotive_health', 5000)
+        Public.set('locomotive_max_health', 5000)
+        Public.set('bonus_xp_on_join', 50)
         WD.set('next_wave', game.tick + 3600 * 5)
-        WPT.set('spidertron_unlocked_at_zone', 6)
+        Public.set('spidertron_unlocked_at_zone', 6)
         WD.set_normal_unit_current_health(1.6)
         WD.set_unit_health_increment_per_wave(0.5)
         WD.set_boss_unit_current_health(4)
         WD.set_boss_health_increment_per_wave(6)
         WD.set('death_mode', true)
-        WPT.set('difficulty_set', true)
+        Public.set('difficulty_set', true)
         Core.iter_players(
             function(player)
                 local pos = surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(surface), 3, 0, 5)
@@ -1205,14 +1205,14 @@ function Public.boost_difficulty()
                 end
             end
         )
-        local upgrades = WPT.get('upgrades')
+        local upgrades = Public.get('upgrades')
         upgrades.locomotive_aura_radius = upgrades.locomotive_aura_radius + 20
         upgrades.aura_upgrades_max = upgrades.aura_upgrades_max - 4
-        if WPT.get('circle') then
-            rendering.destroy(WPT.get('circle'))
+        if Public.get('circle') then
+            rendering.destroy(Public.get('circle'))
         end
-        local locomotive = WPT.get('locomotive')
-        WPT.set(
+        local locomotive = Public.get('locomotive')
+        Public.set(
             'circle',
             rendering.draw_circle {
                 surface = active_surface_index,
@@ -1233,7 +1233,7 @@ end
 
 function Public.set_spawn_position()
     local collapse_pos = Collapse.get_position()
-    local locomotive = WPT.get('locomotive')
+    local locomotive = Public.get('locomotive')
     if not locomotive or not locomotive.valid then
         return
     end
@@ -1259,17 +1259,17 @@ function Public.set_spawn_position()
 
     ::retry::
 
-    local y_value_position = WPT.get('y_value_position')
-    local locomotive_positions = WPT.get('locomotive_pos')
+    local y_value_position = Public.get('y_value_position')
+    local locomotive_positions = Public.get('locomotive_pos')
     local total_pos = #locomotive_positions.tbl
 
-    local active_surface_index = WPT.get('active_surface_index')
+    local active_surface_index = Public.get('active_surface_index')
     local surface = game.surfaces[active_surface_index]
     if not (surface and surface.valid) then
         return
     end
 
-    local spawn_near_collapse = WPT.get('spawn_near_collapse')
+    local spawn_near_collapse = Public.get('spawn_near_collapse')
 
     if spawn_near_collapse.active then
         local collapse_position = surface.find_non_colliding_position('rocket-silo', collapse_pos, 64, 2)
@@ -1344,8 +1344,8 @@ function Public.set_spawn_position()
 end
 
 function Public.on_player_joined_game(event)
-    local active_surface_index = WPT.get('active_surface_index')
-    local players = WPT.get('players')
+    local active_surface_index = Public.get('active_surface_index')
+    local players = Public.get('players')
     local player = game.players[event.player_index]
     local surface = game.surfaces[active_surface_index]
 
@@ -1359,7 +1359,7 @@ function Public.on_player_joined_game(event)
         end
         local message = ({'main.greeting', player.name})
         Alert.alert_player(player, 15, message)
-        if WPT.get('death_mode') then
+        if Public.get('death_mode') then
             local death_message = ({'main.death_mode_warning'})
             Alert.alert_player(player, 15, death_message)
         end
@@ -1389,7 +1389,7 @@ function Public.on_player_joined_game(event)
         end
     end
 
-    local locomotive = WPT.get('locomotive')
+    local locomotive = Public.get('locomotive')
 
     if not locomotive or not locomotive.valid then
         return
@@ -1432,11 +1432,19 @@ function Public.on_player_respawned(event)
 end
 
 function Public.on_player_changed_position(event)
-    local active_surface_index = WPT.get('active_surface_index')
+    local active_surface_index = Public.get('active_surface_index')
     if not active_surface_index then
         return
     end
     local player = game.players[event.player_index]
+    if not player or not player.valid then
+        return
+    end
+
+    if player.controller_type == defines.controllers.spectator then
+        return
+    end
+
     local map_name = 'mtn_v3'
 
     if string.sub(player.surface.name, 0, #map_name) ~= map_name then
@@ -1447,7 +1455,7 @@ function Public.on_player_changed_position(event)
     local surface = game.surfaces[active_surface_index]
 
     local p = {x = player.position.x, y = player.position.y}
-    local config_tile = WPT.get('void_or_tile')
+    local config_tile = Public.get('void_or_tile')
     if config_tile == 'lab-dark-2' then
         local get_tile = surface.get_tile(p)
         if get_tile.valid and get_tile.name == 'lab-dark-2' then
@@ -1529,7 +1537,7 @@ function Public.on_research_finished(event)
 
     local technology_prototypes = game.technology_prototypes
 
-    if WPT.get('print_tech_to_discord') and force.name == 'player' then
+    if Public.get('print_tech_to_discord') and force.name == 'player' then
         Server.to_discord_bold({'functions.researched_complete', technology_prototypes[research_name].localised_name}, true)
     end
 
@@ -1548,7 +1556,7 @@ function Public.on_research_finished(event)
     if not force_name then
         return
     end
-    local flamethrower_damage = WPT.get('flamethrower_damage')
+    local flamethrower_damage = Public.get('flamethrower_damage')
     flamethrower_damage[force_name] = -0.85
     if research.name == 'military' then
         game.forces[force_name].set_turret_attack_modifier('flamethrower-turret', flamethrower_damage[force_name])
@@ -1562,6 +1570,89 @@ function Public.on_research_finished(event)
     end
 end
 
+function Public.set_player_to_god(player)
+    if player.character and player.character.valid then
+        return false
+    end
+
+    if not player.character and player.controller_type ~= defines.controllers.spectator then
+        player.print('[color=blue][Spectate][/color] It seems that you are not in the realm of the living.', Color.warning)
+        return false
+    end
+
+    local spectate = Public.get('spectate')
+
+    if spectate[player.index] and spectate[player.index].delay and spectate[player.index].delay > game.tick then
+        local cooldown = floor((spectate[player.index].delay - game.tick) / 60) + 1 .. ' seconds!'
+        player.print('[color=blue][Spectate][/color] Retry again in ' .. cooldown, Color.warning)
+        return false
+    end
+
+    spectate[player.index] = nil
+
+    player.set_controller({type = defines.controllers.god})
+    player.create_character()
+    local active_surface_index = Public.get('active_surface_index')
+    local surface = game.get_surface(active_surface_index)
+    if not surface or not surface.valid then
+        return false
+    end
+
+    local pos = surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(surface), 3, 0, 5)
+    if pos then
+        player.teleport(pos, surface)
+    else
+        pos = game.forces.player.get_spawn_position(surface)
+        player.teleport(pos, surface)
+    end
+
+    Event.raise(
+        BottomFrame.events.bottom_quickbar_respawn_raise,
+        {
+            player_index = player.index
+        }
+    )
+
+    player.tag = ''
+
+    game.print('[color=blue][Spectate][/color] ' .. player.name .. ' is no longer spectating!')
+    Server.to_discord_bold(table.concat {'*** ', '[Spectate] ' .. player.name .. ' is no longer spectating!', ' ***'})
+    return true
+end
+
+function Public.set_player_to_spectator(player)
+    if player.in_combat then
+        player.print('[color=blue][Spectate][/color] You are in combat. Try again soon.', Color.warning)
+        return false
+    end
+    local spectate = Public.get('spectate')
+
+    if not spectate[player.index] then
+        spectate[player.index] = {
+            verify = false
+        }
+        player.print('[color=blue][Spectate][/color] Please click the spectate button again if you really want to this.', Color.warning)
+        return false
+    end
+
+    if player.character and player.character.valid then
+        player.character.die()
+    end
+
+    player.character = nil
+    player.spectator = true
+    player.tag = '[Spectator]'
+    player.set_controller({type = defines.controllers.spectator})
+    game.print('[color=blue][Spectate][/color] ' .. player.name .. ' is now spectating.')
+    Server.to_discord_bold(table.concat {'*** ', '[Spectate] ' .. player.name .. ' is now spectating.', ' ***'})
+
+    if spectate[player.index] and not spectate[player.index].delay then
+        spectate[player.index].verify = true
+        spectate[player.index].delay = game.tick + 18000
+    end
+    return true
+end
+
 Public.firearm_magazine_ammo = {name = 'firearm-magazine', count = 200}
 Public.piercing_rounds_magazine_ammo = {name = 'piercing-rounds-magazine', count = 200}
 Public.uranium_rounds_magazine_ammo = {name = 'uranium-rounds-magazine', count = 200}
@@ -1569,7 +1660,7 @@ Public.light_oil_ammo = {name = 'light-oil', amount = 100}
 Public.artillery_shell_ammo = {name = 'artillery-shell', count = 15}
 Public.laser_turrent_power_source = {buffer_size = 2400000, power_production = 40000}
 
-function Public.reset_table()
+function Public.reset_func_table()
     this.power_sources = {index = 1}
     this.refill_turrets = {index = 1}
     this.magic_crafters = {index = 1}
diff --git a/maps/mountain_fortress_v3/generate.lua b/maps/mountain_fortress_v3/generate.lua
index a2ff5304..5cb75504 100644
--- a/maps/mountain_fortress_v3/generate.lua
+++ b/maps/mountain_fortress_v3/generate.lua
@@ -1,15 +1,10 @@
-local Market = require 'maps.mountain_fortress_v3.basic_markets'
-local WPT = require 'maps.mountain_fortress_v3.table'
-local Loot = require 'maps.mountain_fortress_v3.loot'
+local Event = require 'utils.event'
+local Public = require 'maps.mountain_fortress_v3.table'
 local Task = require 'utils.task'
 local Token = require 'utils.token'
-local Event = require 'utils.event'
-local Terrain = require 'maps.mountain_fortress_v3.terrain'
 local WD = require 'modules.wave_defense.table'
 local BiterHealthBooster = require 'modules.biter_health_booster_v2'
 
-local Public = {}
-
 local random = math.random
 local abs = math.abs
 local ceil = math.ceil
@@ -18,7 +13,8 @@ local queue_task = Task.queue_task
 local tiles_per_call = 8
 local total_calls = ceil(1024 / tiles_per_call)
 local regen_decoratives = false
-local generate_map = Terrain.heavy_functions
+local generate_map = Public.heavy_functions
+
 local winter_mode = false
 local wintery_type = {
     ['simple-entity'] = true,
@@ -211,7 +207,7 @@ local function do_place_treasure(data)
         if random(1, 6) == 1 then
             e.chest = 'iron-chest'
         end
-        Loot.add(surface, e.position, e.chest)
+        Public.add_loot(surface, e.position, e.chest)
     end
 end
 
@@ -231,7 +227,7 @@ local function do_place_markets(data)
             limit = 1
         } == 0
      then
-        local market = Market.mountain_market(surface, pos, abs(pos.y) * 0.004)
+        local market = Public.mountain_market(surface, pos, abs(pos.y) * 0.004)
         market.destructible = false
     end
 end
@@ -618,11 +614,12 @@ local do_chunk = Public.do_chunk
 local schedule_chunk = Public.schedule_chunk
 
 local function on_chunk(event)
-    local force_chunk = WPT.get('force_chunk')
-    local stop_chunk = WPT.get('stop_chunk')
+    local force_chunk = Public.get('force_chunk')
+    local stop_chunk = Public.get('stop_chunk')
     if stop_chunk then
         return
     end
+
     if force_chunk then
         do_chunk(event)
     else
diff --git a/maps/mountain_fortress_v3/get_perlin.lua b/maps/mountain_fortress_v3/get_perlin.lua
index cb6336ba..1bf0eb60 100644
--- a/maps/mountain_fortress_v3/get_perlin.lua
+++ b/maps/mountain_fortress_v3/get_perlin.lua
@@ -1,3 +1,4 @@
+local Public = require 'maps.mountain_fortress_v3.table'
 local simplex_noise = require 'utils.simplex_noise'.d2
 
 --add or use noise templates from here
@@ -125,7 +126,7 @@ local noises = {
 }
 
 --returns a float number between -1 and 1
-local function get_noise(name, pos, seed)
+function Public.get_noise(name, pos, seed)
     local noise = 0
     local d = 0
     for i = 1, #noises[name] do
@@ -138,4 +139,4 @@ local function get_noise(name, pos, seed)
     return noise
 end
 
-return get_noise
+return Public
diff --git a/maps/mountain_fortress_v3/gui.lua b/maps/mountain_fortress_v3/gui.lua
index 379d8d38..fa4b34b4 100644
--- a/maps/mountain_fortress_v3/gui.lua
+++ b/maps/mountain_fortress_v3/gui.lua
@@ -1,6 +1,6 @@
 local Event = require 'utils.event'
+local Public = require 'maps.mountain_fortress_v3.table'
 local RPG = require 'modules.rpg.main'
-local WPT = require 'maps.mountain_fortress_v3.table'
 local IC_Gui = require 'maps.mountain_fortress_v3.ic.gui'
 local IC_Minimap = require 'maps.mountain_fortress_v3.ic.minimap'
 local Difficulty = require 'modules.difficulty_vote_by_amount'
@@ -9,10 +9,8 @@ local SpamProtection = require 'utils.spam_protection'
 
 local format_number = require 'util'.format_number
 
-local Public = {}
-Public.events = {reset_map = Event.generate_event_name('reset_map')}
-
 local main_button_name = Gui.uid_name()
+local spectate_button_name = Gui.uid_name()
 local main_frame_name = Gui.uid_name()
 local floor = math.floor
 
@@ -57,6 +55,22 @@ local function create_button(player)
     b.style.maximal_height = 38
 end
 
+local function spectate_button(player)
+    if player.gui.top[spectate_button_name] then
+        return
+    end
+
+    local b =
+        player.gui.top.add {
+        type = 'sprite-button',
+        name = spectate_button_name,
+        sprite = 'utility/ghost_time_to_live_modifier_icon',
+        tooltip = 'Spectate!\nThis will kill your character.'
+    }
+
+    b.style.maximal_height = 38
+end
+
 local function create_main_frame(player)
     local label
     local line
@@ -142,6 +156,22 @@ local function create_main_frame(player)
     label.style.right_padding = 4
 end
 
+local function hide_all_gui(player)
+    for _, child in pairs(player.gui.top.children) do
+        if child.name ~= spectate_button_name then
+            child.visible = false
+        end
+    end
+end
+
+local function show_all_gui(player)
+    for _, child in pairs(player.gui.top.children) do
+        if child.name ~= spectate_button_name then
+            child.visible = true
+        end
+    end
+end
+
 local function on_player_joined_game(event)
     local player = game.players[event.player_index]
     if not player then
@@ -151,6 +181,10 @@ local function on_player_joined_game(event)
     if not player.gui.top[main_button_name] then
         create_button(player)
     end
+
+    if not player.gui.top[spectate_button_name] then
+        spectate_button(player)
+    end
 end
 
 local function on_gui_click(event)
@@ -171,7 +205,7 @@ local function on_gui_click(event)
             return
         end
 
-        local locomotive = WPT.get('locomotive')
+        local locomotive = Public.get('locomotive')
         if not validate_entity(locomotive) then
             return
         end
@@ -249,11 +283,12 @@ local function on_player_changed_surface(event)
     local rpg_button = RPG.draw_main_frame_name
     local rpg_frame = RPG.main_frame_name
     local rpg_settings = RPG.settings_frame_name
-    local main = WPT.get('locomotive')
-    local icw_locomotive = WPT.get('icw_locomotive')
+    local main = Public.get('locomotive')
+    local icw_locomotive = Public.get('icw_locomotive')
     local wagon_surface = icw_locomotive.surface
     local info = player.gui.top[main_button_name]
     local wd = player.gui.top['wave_defense']
+    local spectate = player.gui.top[spectate_button_name]
     local rpg_b = player.gui.top[rpg_button]
     local rpg_f = player.gui.screen[rpg_frame]
     local rpg_s = player.gui.screen[rpg_settings]
@@ -299,6 +334,9 @@ local function on_player_changed_surface(event)
         if wd and not wd.visible then
             wd.visible = true
         end
+        if spectate and not spectate.visible then
+            spectate.visible = true
+        end
         if charging and not charging.visible then
             charging.visible = true
         end
@@ -311,6 +349,9 @@ local function on_player_changed_surface(event)
         if wd then
             wd.visible = false
         end
+        if spectate then
+            spectate.visible = false
+        end
         if rpg_b then
             rpg_b.visible = false
         end
@@ -356,6 +397,7 @@ local function enable_guis(event)
     local rpg_button = RPG.draw_main_frame_name
     local info = player.gui.top[main_button_name]
     local wd = player.gui.top['wave_defense']
+    local spectate = player.gui.top[spectate_button_name]
     local rpg_b = player.gui.top[rpg_button]
     local diff = player.gui.top[Difficulty.top_button_name]
     local charging = player.gui.top['charging_station']
@@ -382,6 +424,9 @@ local function enable_guis(event)
     if wd and not wd.visible then
         wd.visible = true
     end
+    if spectate and not spectate.visible then
+        spectate.visible = true
+    end
     if charging and not charging.visible then
         charging.visible = true
     end
@@ -407,9 +452,9 @@ function Public.update_gui(player)
     local gui = player.gui.top[main_frame_name]
 
     local rpg_extra = RPG.get('rpg_extra')
-    local mined_scrap = WPT.get('mined_scrap')
-    local biters_killed = WPT.get('biters_killed')
-    local upgrades = WPT.get('upgrades')
+    local mined_scrap = Public.get('mined_scrap')
+    local biters_killed = Public.get('biters_killed')
+    local upgrades = Public.get('upgrades')
 
     if rpg_extra.global_pool == 0 then
         gui.global_pool.caption = 'XP: 0'
@@ -422,7 +467,7 @@ function Public.update_gui(player)
     gui.scrap_mined.caption = ' [img=entity.tree-01][img=entity.rock-huge]: ' .. format_number(mined_scrap, true)
     gui.scrap_mined.tooltip = ({'gui.amount_harvested'})
 
-    local pickaxe_upgrades = WPT.pickaxe_upgrades
+    local pickaxe_upgrades = Public.pickaxe_upgrades
     local pick_tier = pickaxe_upgrades[upgrades.pickaxe_tier]
     local speed = math.round((player.force.manual_mining_speed_modifier + player.character_mining_speed_modifier + 1) * 100)
     local train_upgrade_contribution = upgrades.train_upgrade_contribution
@@ -454,4 +499,31 @@ Event.add(defines.events.on_player_changed_surface, on_player_changed_surface)
 Event.add(defines.events.on_gui_click, on_gui_click)
 Event.add(Public.events.reset_map, enable_guis)
 
+Gui.on_click(
+    spectate_button_name,
+    function(event)
+        local is_spamming = SpamProtection.is_spamming(event.player, nil, 'Mtn v3 Spectate Button')
+        if is_spamming then
+            return
+        end
+
+        local player = event.player
+        if not player or not player.valid then
+            return
+        end
+
+        if player.character and player.character.valid then
+            local success = Public.set_player_to_spectator(player)
+            if success then
+                hide_all_gui(player)
+            end
+        else
+            local success = Public.set_player_to_god(player)
+            if success then
+                show_all_gui(player)
+            end
+        end
+    end
+)
+
 return Public
diff --git a/maps/mountain_fortress_v3/highscore.lua b/maps/mountain_fortress_v3/highscore.lua
index 73b68925..c8aade90 100644
--- a/maps/mountain_fortress_v3/highscore.lua
+++ b/maps/mountain_fortress_v3/highscore.lua
@@ -1,10 +1,10 @@
 local Event = require 'utils.event'
+local Public = require 'maps.mountain_fortress_v3.table'
 local Global = require 'utils.global'
 local Server = require 'utils.server'
 local Token = require 'utils.token'
 local Gui = require 'utils.gui'
 local Score = require 'utils.gui.score'
-local WPT = require 'maps.mountain_fortress_v3.table'
 local WD = require 'modules.wave_defense.table'
 local Core = require 'utils.core'
 local SpamProtection = require 'utils.spam_protection'
@@ -15,7 +15,6 @@ local score_key = 'mountain_fortress_v3_scores'
 local set_data = Server.set_data
 local try_get_data = Server.try_get_data
 
-local Public = {}
 local insert = table.insert
 local random = math.random
 local this = {
@@ -291,7 +290,7 @@ end
 
 local function write_additional_stats(key, difficulty)
     local player = game.forces.player
-    local new_breached_zone = WPT.get('breached_wall')
+    local new_breached_zone = Public.get('breached_wall')
     local new_wave_number = WD.get('wave_number')
     local new_biters_killed = get_total_biter_killcount(player)
     local new_rockets_launched = player.rockets_launched
diff --git a/maps/mountain_fortress_v3/ic/functions.lua b/maps/mountain_fortress_v3/ic/functions.lua
index f04959dd..228958d9 100644
--- a/maps/mountain_fortress_v3/ic/functions.lua
+++ b/maps/mountain_fortress_v3/ic/functions.lua
@@ -10,7 +10,6 @@ local Event = require 'utils.event'
 
 local Public = {}
 local main_tile_name = 'black-refined-concrete'
-local raise_event = script.raise_event
 local round = math.round
 local floor = math.floor
 
@@ -140,7 +139,7 @@ local function get_entity_from_player_surface(cars, player)
 end
 
 local function get_owner_car_surface(cars, player, target)
-    for k, car in pairs(cars) do
+    for _, car in pairs(cars) do
         if car.owner == player.index then
             local surface_index = car.surface
             local surface = game.surfaces[surface_index]
@@ -173,7 +172,7 @@ end
 
 local function get_player_entity(player)
     local cars = IC.get('cars')
-    for k, car in pairs(cars) do
+    for _, car in pairs(cars) do
         if car.owner == player.index and type(car.entity) == 'boolean' then
             return car.name, true
         elseif car.owner == player.index then
@@ -187,7 +186,7 @@ local function get_owner_car_name(player)
     local cars = IC.get('cars')
     local saved_surfaces = IC.get('saved_surfaces')
     local index = saved_surfaces[player.index]
-    for k, car in pairs(cars) do
+    for _, car in pairs(cars) do
         if not index then
             return false
         end
@@ -819,6 +818,10 @@ function Public.kill_car(entity)
 
     local renders = IC.get('renders')
 
+    if not owner then
+        return
+    end
+
     if renders[owner.index] then
         rendering.destroy(renders[owner.index])
         renders[owner.index] = nil
@@ -892,6 +895,10 @@ function Public.kill_car_but_save_surface(entity)
         end
     end
 
+    if not owner then
+        return
+    end
+
     local renders = IC.get('renders')
 
     if renders[owner.index] then
@@ -1246,7 +1253,7 @@ function Public.use_door_with_entity(player, door)
         local surface_index = car.surface
         local surface = game.surfaces[surface_index]
         if validate_entity(car.entity) and car.owner == player.index then
-            raise_event(
+            Event.raise(
                 IC.events.used_car_door,
                 {
                     player = player,
@@ -1277,7 +1284,7 @@ function Public.use_door_with_entity(player, door)
         player_data.surface = surface.index
     else
         if validate_entity(car.entity) and car.owner == player.index then
-            raise_event(
+            Event.raise(
                 IC.events.used_car_door,
                 {
                     player = player,
diff --git a/maps/mountain_fortress_v3/ic/gui.lua b/maps/mountain_fortress_v3/ic/gui.lua
index ccb4b8ac..18377a94 100644
--- a/maps/mountain_fortress_v3/ic/gui.lua
+++ b/maps/mountain_fortress_v3/ic/gui.lua
@@ -31,7 +31,6 @@ local auto_upgrade_name = Gui.uid_name()
 local kick_player_name = Gui.uid_name()
 local destroy_surface_name = Gui.uid_name()
 
-local raise_event = script.raise_event
 local add_toolbar
 local remove_toolbar
 
@@ -869,7 +868,7 @@ Gui.on_click(
             if player_list.players[name] then
                 player.print('[IC] ' .. name .. ' was removed from your vehicle.', Color.info)
                 decrement(player_list.players, name)
-                raise_event(
+                Event.raise(
                     ICT.events.on_player_kicked_from_surface,
                     {
                         player = player,
diff --git a/maps/mountain_fortress_v3/icw/functions.lua b/maps/mountain_fortress_v3/icw/functions.lua
index 819d8a36..cb7341ae 100644
--- a/maps/mountain_fortress_v3/icw/functions.lua
+++ b/maps/mountain_fortress_v3/icw/functions.lua
@@ -199,52 +199,6 @@ local function input_filtered(wagon_inventory, chest, chest_inventory, free_slot
     end
 end
 
-local remove_lights_token =
-    Token.register(
-    function(data)
-        local id = data.id
-        if id then
-            rendering.destroy(id)
-        end
-    end
-)
-
-function Public.glimpse_of_lights()
-    local surface = WPT.get('loco_surface')
-    if not surface or not surface.valid then
-        return
-    end
-
-    local icw = ICW.get()
-
-    local hazardous_debris = icw.hazardous_debris
-    if not hazardous_debris then
-        return
-    end
-
-    local text = rendering.draw_text
-    local position = fallout_debris[random(1, size_of_debris)]
-
-    local p = {x = position[1], y = position[2]}
-    local get_tile = surface.get_tile(p)
-    if get_tile.valid and get_tile.name == 'out-of-map' then
-        local id =
-            text {
-            text = '★',
-            surface = surface,
-            target = position,
-            color = {r = 1, g = 1, b = 0},
-            orientation = random(0, 100) * 0.01,
-            scale = 0.4,
-            font = 'heading-1',
-            alignment = 'center',
-            scale_with_zoom = false
-        }
-
-        Task.set_timeout_in_ticks(300, remove_lights_token, {id = id})
-    end
-end
-
 function Public.hazardous_debris()
     local surface = WPT.get('loco_surface')
     if not surface or not surface.valid then
diff --git a/maps/mountain_fortress_v3/icw/main.lua b/maps/mountain_fortress_v3/icw/main.lua
index 4ccdf4c7..e4173fe1 100644
--- a/maps/mountain_fortress_v3/icw/main.lua
+++ b/maps/mountain_fortress_v3/icw/main.lua
@@ -96,7 +96,6 @@ local function on_tick()
     if tick % 10 == 0 then
         Functions.item_transfer()
         Functions.hazardous_debris()
-    -- Functions.glimpse_of_lights()
     end
     if tick % 240 == 0 then
         Functions.update_minimap()
diff --git a/maps/mountain_fortress_v3/icw/table.lua b/maps/mountain_fortress_v3/icw/table.lua
index c68bbd49..566105f8 100644
--- a/maps/mountain_fortress_v3/icw/table.lua
+++ b/maps/mountain_fortress_v3/icw/table.lua
@@ -12,7 +12,7 @@ local Public = {}
 
 function Public.reset()
     if this.surfaces then
-        for k, surface in pairs(this.surfaces) do
+        for _, surface in pairs(this.surfaces) do
             if surface and surface.valid then
                 game.delete_surface(surface)
             end
diff --git a/maps/mountain_fortress_v3/locomotive.lua b/maps/mountain_fortress_v3/locomotive.lua
index e1326cdc..675e45c8 100644
--- a/maps/mountain_fortress_v3/locomotive.lua
+++ b/maps/mountain_fortress_v3/locomotive.lua
@@ -1,17 +1,12 @@
 local Event = require 'utils.event'
-local Market = require 'maps.mountain_fortress_v3.basic_markets'
-local LocomotiveMarket = require 'maps.mountain_fortress_v3.locomotive.market'
+local Public = require 'maps.mountain_fortress_v3.table'
 local ICW = require 'maps.mountain_fortress_v3.icw.main'
-local WPT = require 'maps.mountain_fortress_v3.table'
 local ICFunctions = require 'maps.mountain_fortress_v3.ic.functions'
 local Session = require 'utils.datastore.session_data'
 local Difficulty = require 'modules.difficulty_vote_by_amount'
 local RPG = require 'modules.rpg.main'
 local Gui = require 'utils.gui'
 local Alert = require 'utils.alert'
-local PermissionGroups = require 'maps.mountain_fortress_v3.locomotive.permission_groups'
-
-local Public = {}
 
 local rpg_main_frame = RPG.main_frame_name
 local random = math.random
@@ -40,8 +35,8 @@ local non_valid_vehicles = {
 }
 
 local function add_random_loot_to_main_market(rarity)
-    local main_market_items = WPT.get('main_market_items')
-    local items = Market.get_random_item(rarity, true, false)
+    local main_market_items = Public.get('main_market_items')
+    local items = Public.get_random_item(rarity, true, false)
     if not items then
         return false
     end
@@ -118,7 +113,7 @@ local function hurt_players_outside_of_aura()
     if not Diff then
         return
     end
-    local difficulty_set = WPT.get('difficulty_set')
+    local difficulty_set = Public.get('difficulty_set')
     if not difficulty_set then
         return
     end
@@ -129,14 +124,14 @@ local function hurt_players_outside_of_aura()
         death_mode = true
     end
 
-    local loco_surface = WPT.get('loco_surface')
+    local loco_surface = Public.get('loco_surface')
     if not (loco_surface and loco_surface.valid) then
         return
     end
-    local locomotive = WPT.get('locomotive')
+    local locomotive = Public.get('locomotive')
     local loco = locomotive.position
 
-    local upgrades = WPT.get('upgrades')
+    local upgrades = Public.get('upgrades')
 
     local players = game.connected_players
     for i = 1, #players do
@@ -207,12 +202,12 @@ end
 local function give_passive_xp(data)
     local xp_floating_text_color = {r = 188, g = 201, b = 63}
     local visuals_delay = 1800
-    local loco_surface = WPT.get('loco_surface')
+    local loco_surface = Public.get('loco_surface')
     if not (loco_surface and loco_surface.valid) then
         return
     end
-    local upgrades = WPT.get('upgrades')
-    local locomotive = WPT.get('locomotive')
+    local upgrades = Public.get('upgrades')
+    local locomotive = Public.get('locomotive')
     local rpg = data.rpg
     local loco = locomotive.position
 
@@ -225,12 +220,12 @@ local function give_passive_xp(data)
         if player.afk_time < 200 and not RPG.get_last_spell_cast(player) then
             if inside or player.surface.index == loco_surface.index then
                 if player.surface.index == loco_surface.index then
-                    PermissionGroups.add_player_to_permission_group(player, 'limited')
+                    Public.add_player_to_permission_group(player, 'limited')
                 elseif ICFunctions.get_player_surface(player) then
-                    PermissionGroups.add_player_to_permission_group(player, 'limited')
+                    Public.add_player_to_permission_group(player, 'limited')
                     goto pre_exit
                 else
-                    PermissionGroups.add_player_to_permission_group(player, 'near_locomotive')
+                    Public.add_player_to_permission_group(player, 'near_locomotive')
                 end
 
                 local pos = player.position
@@ -254,11 +249,11 @@ local function give_passive_xp(data)
                     end
                 end
             else
-                local active_surface_index = WPT.get('active_surface_index')
+                local active_surface_index = Public.get('active_surface_index')
                 local surface = game.surfaces[active_surface_index]
                 if surface and surface.valid then
                     if player.surface.index == surface.index then
-                        PermissionGroups.add_player_to_permission_group(player, 'main_surface')
+                        Public.add_player_to_permission_group(player, 'main_surface')
                     end
                 end
             end
@@ -268,7 +263,7 @@ local function give_passive_xp(data)
 end
 
 local function fish_tag()
-    local locomotive_cargo = WPT.get('locomotive_cargo')
+    local locomotive_cargo = Public.get('locomotive_cargo')
     if not (locomotive_cargo and locomotive_cargo.valid) then
         return
     end
@@ -276,7 +271,7 @@ local function fish_tag()
         return
     end
 
-    local locomotive_tag = WPT.get('locomotive_tag')
+    local locomotive_tag = Public.get('locomotive_tag')
 
     if locomotive_tag then
         if locomotive_tag.valid then
@@ -286,7 +281,7 @@ local function fish_tag()
             locomotive_tag.destroy()
         end
     end
-    WPT.set(
+    Public.set(
         'locomotive_tag',
         locomotive_cargo.force.add_chart_tag(
             locomotive_cargo.surface,
@@ -300,7 +295,7 @@ local function fish_tag()
 end
 
 local function set_player_spawn()
-    local locomotive = WPT.get('locomotive')
+    local locomotive = Public.get('locomotive')
     if not locomotive then
         return
     end
@@ -316,7 +311,7 @@ local function set_player_spawn()
 end
 
 local function refill_fish()
-    local locomotive_cargo = WPT.get('locomotive_cargo')
+    local locomotive_cargo = Public.get('locomotive_cargo')
     if not locomotive_cargo then
         return
     end
@@ -327,7 +322,7 @@ local function refill_fish()
 end
 
 local function set_carriages()
-    local locomotive = WPT.get('locomotive')
+    local locomotive = Public.get('locomotive')
     if not locomotive or not locomotive.valid then
         return
     end
@@ -345,8 +340,8 @@ local function set_carriages()
         end
     end
 
-    WPT.set('carriages_numbers', t)
-    WPT.set('carriages', locomotive.train.carriages)
+    Public.set('carriages_numbers', t)
+    Public.set('carriages', locomotive.train.carriages)
 end
 
 local function get_driver_action(entity)
@@ -388,17 +383,17 @@ local function get_driver_action(entity)
 end
 
 local function set_locomotive_health()
-    local locomotive_health = WPT.get('locomotive_health')
-    local locomotive_max_health = WPT.get('locomotive_max_health')
-    local locomotive = WPT.get('locomotive')
+    local locomotive_health = Public.get('locomotive_health')
+    local locomotive_max_health = Public.get('locomotive_max_health')
+    local locomotive = Public.get('locomotive')
 
     local function check_health()
         local m = locomotive_health / locomotive_max_health
         if locomotive_health > locomotive_max_health then
-            WPT.set('locomotive_health', locomotive_max_health)
+            Public.set('locomotive_health', locomotive_max_health)
         end
-        rendering.set_text(WPT.get('health_text'), 'HP: ' .. round(locomotive_health) .. ' / ' .. round(locomotive_max_health))
-        local carriages = WPT.get('carriages')
+        rendering.set_text(Public.get('health_text'), 'HP: ' .. round(locomotive_health) .. ' / ' .. round(locomotive_max_health))
+        local carriages = Public.get('carriages')
         if carriages then
             for i = 1, #carriages do
                 local entity = carriages[i]
@@ -424,7 +419,7 @@ local function set_locomotive_health()
 end
 
 local function validate_index()
-    local locomotive = WPT.get('locomotive')
+    local locomotive = Public.get('locomotive')
     if not locomotive then
         return
     end
@@ -433,12 +428,12 @@ local function validate_index()
     end
 
     local icw_table = ICW.get_table()
-    local icw_locomotive = WPT.get('icw_locomotive')
+    local icw_locomotive = Public.get('icw_locomotive')
     local loco_surface = icw_locomotive.surface
     local unit_surface = locomotive.unit_number
     local locomotive_surface = game.surfaces[icw_table.wagons[unit_surface].surface.index]
     if loco_surface.valid then
-        WPT.set('loco_surface', locomotive_surface)
+        Public.set('loco_surface', locomotive_surface)
     end
 end
 
@@ -459,21 +454,21 @@ local function on_research_finished(event)
         Alert.alert_all_players(15, message, nil, 'achievement/tech-maniac', 0.1)
     end
 
-    local locomotive = WPT.get('locomotive')
+    local locomotive = Public.get('locomotive')
     if not locomotive or not locomotive.valid then
         return
     end
 
-    local market_announce = WPT.get('market_announce')
+    local market_announce = Public.get('market_announce')
     if market_announce > game.tick then
         return
     end
 
-    local breached_wall = WPT.get('breached_wall')
+    local breached_wall = Public.get('breached_wall')
     add_random_loot_to_main_market(breached_wall)
     local message = ({'locomotive.new_items_at_market'})
     Alert.alert_all_players(5, message, nil, 'achievement/tech-maniac', 0.1)
-    LocomotiveMarket.refresh_gui()
+    Public.refresh_gui()
 end
 
 local function on_player_changed_surface(event)
@@ -482,7 +477,7 @@ local function on_player_changed_surface(event)
         return
     end
 
-    local active_surface = WPT.get('active_surface_index')
+    local active_surface = Public.get('active_surface_index')
     local surface = game.surfaces[active_surface]
     if not surface or not surface.valid then
         return
@@ -511,14 +506,14 @@ local function on_player_changed_surface(event)
         end
     end
 
-    local locomotive_surface = WPT.get('loco_surface')
+    local locomotive_surface = Public.get('loco_surface')
 
     if locomotive_surface and locomotive_surface.valid and player.surface.index == locomotive_surface.index then
-        return PermissionGroups.add_player_to_permission_group(player, 'limited')
+        return Public.add_player_to_permission_group(player, 'limited')
     elseif ICFunctions.get_player_surface(player) then
-        return PermissionGroups.add_player_to_permission_group(player, 'limited')
+        return Public.add_player_to_permission_group(player, 'limited')
     elseif player.surface.index == surface.index then
-        return PermissionGroups.add_player_to_permission_group(player, 'main_surface')
+        return Public.add_player_to_permission_group(player, 'main_surface')
     end
 end
 
@@ -537,7 +532,7 @@ local function on_player_driving_changed_state(event)
         return
     end
 
-    local locomotive = WPT.get('locomotive')
+    local locomotive = Public.get('locomotive')
     if not locomotive or not locomotive.valid then
         return
     end
@@ -553,11 +548,11 @@ end
 
 function Public.boost_players_around_train()
     local rpg = RPG.get('rpg_t')
-    local active_surface_index = WPT.get('active_surface_index')
+    local active_surface_index = Public.get('active_surface_index')
     if not active_surface_index then
         return
     end
-    local locomotive = WPT.get('locomotive')
+    local locomotive = Public.get('locomotive')
     if not (locomotive and locomotive.valid) then
         return
     end
@@ -575,8 +570,8 @@ function Public.boost_players_around_train()
 end
 
 function Public.is_around_train(entity)
-    local locomotive = WPT.get('locomotive')
-    local active_surface_index = WPT.get('active_surface_index')
+    local locomotive = Public.get('locomotive')
+    local active_surface_index = Public.get('active_surface_index')
 
     if not active_surface_index then
         return false
@@ -593,7 +588,7 @@ function Public.is_around_train(entity)
     end
 
     local surface = game.surfaces[active_surface_index]
-    local upgrades = WPT.get('upgrades')
+    local upgrades = Public.get('upgrades')
 
     local data = {
         locomotive = locomotive,
@@ -607,15 +602,15 @@ function Public.is_around_train(entity)
 end
 
 function Public.render_train_hp()
-    local active_surface_index = WPT.get('active_surface_index')
+    local active_surface_index = Public.get('active_surface_index')
     local surface = game.surfaces[active_surface_index]
 
-    local locomotive_health = WPT.get('locomotive_health')
-    local locomotive_max_health = WPT.get('locomotive_max_health')
-    local locomotive = WPT.get('locomotive')
-    local upgrades = WPT.get('upgrades')
+    local locomotive_health = Public.get('locomotive_health')
+    local locomotive_max_health = Public.get('locomotive_max_health')
+    local locomotive = Public.get('locomotive')
+    local upgrades = Public.get('upgrades')
 
-    WPT.set(
+    Public.set(
         'health_text',
         rendering.draw_text {
             text = 'HP: ' .. locomotive_health .. ' / ' .. locomotive_max_health,
@@ -630,7 +625,7 @@ function Public.render_train_hp()
         }
     )
 
-    WPT.set(
+    Public.set(
         'caption',
         rendering.draw_text {
             text = 'Comfy Choo Choo',
@@ -645,7 +640,7 @@ function Public.render_train_hp()
         }
     )
 
-    WPT.set(
+    Public.set(
         'circle',
         rendering.draw_circle {
             surface = surface,
@@ -659,18 +654,18 @@ function Public.render_train_hp()
 end
 
 function Public.transfer_pollution()
-    local locomotive = WPT.get('locomotive')
+    local locomotive = Public.get('locomotive')
     if not locomotive or not locomotive.valid then
         return
     end
 
-    local active_surface_index = WPT.get('active_surface_index')
+    local active_surface_index = Public.get('active_surface_index')
     local active_surface = game.surfaces[active_surface_index]
     if not active_surface or not active_surface.valid then
         return
     end
 
-    local icw_locomotive = WPT.get('icw_locomotive')
+    local icw_locomotive = Public.get('icw_locomotive')
     local surface = icw_locomotive.surface
     if not surface or not surface.valid then
         return
diff --git a/maps/mountain_fortress_v3/locomotive/defense_system.lua b/maps/mountain_fortress_v3/locomotive/defense_system.lua
index b5be5334..9896df1d 100644
--- a/maps/mountain_fortress_v3/locomotive/defense_system.lua
+++ b/maps/mountain_fortress_v3/locomotive/defense_system.lua
@@ -1,14 +1,12 @@
-local WPT = require 'maps.mountain_fortress_v3.table'
+local Public = require 'maps.mountain_fortress_v3.table'
 
 local random = math.random
 local rad = math.rad
 local sin = math.sin
 local cos = math.cos
 
-local Public = {}
-
 local function create_defense_system(position, name, target)
-    local active_surface_index = WPT.get('active_surface_index')
+    local active_surface_index = Public.get('active_surface_index')
     local surface = game.surfaces[active_surface_index]
 
     local random_angles = {
@@ -78,7 +76,7 @@ local function create_defense_system(position, name, target)
 end
 
 function Public.enable_poison_defense(pos)
-    local locomotive = WPT.get('locomotive')
+    local locomotive = Public.get('locomotive')
     if not locomotive then
         return
     end
@@ -90,7 +88,7 @@ function Public.enable_poison_defense(pos)
 end
 
 function Public.enable_robotic_defense(pos)
-    local locomotive = WPT.get('locomotive')
+    local locomotive = Public.get('locomotive')
     if not locomotive then
         return
     end
diff --git a/maps/mountain_fortress_v3/locomotive/friendly_pet.lua b/maps/mountain_fortress_v3/locomotive/friendly_pet.lua
index e086f753..de5866e9 100644
--- a/maps/mountain_fortress_v3/locomotive/friendly_pet.lua
+++ b/maps/mountain_fortress_v3/locomotive/friendly_pet.lua
@@ -1,15 +1,13 @@
 local Event = require 'utils.event'
-local WPT = require 'maps.mountain_fortress_v3.table'
+local Public = require 'maps.mountain_fortress_v3.table'
 
 local random = math.random
 
-local Public = {}
-
 local function shoo(event)
-    local icw_locomotive = WPT.get('icw_locomotive')
+    local icw_locomotive = Public.get('icw_locomotive')
     local loco_surface = icw_locomotive.surface
 
-    if not loco_surface.valid then
+    if not loco_surface or not loco_surface.valid then
         return
     end
 
@@ -21,7 +19,7 @@ local function shoo(event)
         end
     end
 
-    local locomotive_biter = WPT.get('locomotive_biter')
+    local locomotive_biter = Public.get('locomotive_biter')
     local surface = player.surface
     local message = event.message
     message = string.lower(message)
@@ -49,7 +47,7 @@ local function shoo(event)
                 }
                 surface.create_entity(explosion)
                 locomotive_biter.destroy()
-                WPT.set().locomotive_biter = nil
+                Public.set().locomotive_biter = nil
             end
             return
         end
@@ -57,7 +55,7 @@ local function shoo(event)
 end
 
 function Public.spawn_biter()
-    local this = WPT.get()
+    local this = Public.get()
     local loco_surface = this.icw_locomotive.surface
 
     if not loco_surface.valid then
diff --git a/maps/mountain_fortress_v3/locomotive/linked_chests.lua b/maps/mountain_fortress_v3/locomotive/linked_chests.lua
index 55d1b135..4179b1ba 100644
--- a/maps/mountain_fortress_v3/locomotive/linked_chests.lua
+++ b/maps/mountain_fortress_v3/locomotive/linked_chests.lua
@@ -1,8 +1,6 @@
 local Event = require 'utils.event'
+local Public = require 'maps.mountain_fortress_v3.table'
 local ICW = require 'maps.mountain_fortress_v3.icw.main'
-local WPT = require 'maps.mountain_fortress_v3.table'
-
-local Public = {}
 
 local function contains_positions(area)
     local function inside(pos)
@@ -52,9 +50,9 @@ local function on_built_entity(event)
         return
     end
 
-    local outside_chests = WPT.get('outside_chests')
-    local chests_linked_to = WPT.get('chests_linked_to')
-    local upgrades = WPT.get('upgrades')
+    local outside_chests = Public.get('outside_chests')
+    local chests_linked_to = Public.get('chests_linked_to')
+    local upgrades = Public.get('upgrades')
     local chest_created
     local increased = false
 
@@ -124,8 +122,8 @@ local function on_player_and_robot_mined_entity(event)
         return
     end
 
-    local outside_chests = WPT.get('outside_chests')
-    local chests_linked_to = WPT.get('chests_linked_to')
+    local outside_chests = Public.get('outside_chests')
+    local chests_linked_to = Public.get('chests_linked_to')
 
     if outside_chests[entity.unit_number] then
         for k, data in pairs(chests_linked_to) do
@@ -144,8 +142,8 @@ local function on_player_and_robot_mined_entity(event)
 end
 
 local function divide_contents()
-    local outside_chests = WPT.get('outside_chests')
-    local chests_linked_to = WPT.get('chests_linked_to')
+    local outside_chests = Public.get('outside_chests')
+    local chests_linked_to = Public.get('chests_linked_to')
     local target_chest
 
     if not next(outside_chests) then
diff --git a/maps/mountain_fortress_v3/locomotive/market.lua b/maps/mountain_fortress_v3/locomotive/market.lua
index 725a914c..58a71fb9 100644
--- a/maps/mountain_fortress_v3/locomotive/market.lua
+++ b/maps/mountain_fortress_v3/locomotive/market.lua
@@ -1,7 +1,6 @@
 local Event = require 'utils.event'
-local Generate = require 'maps.mountain_fortress_v3.generate'
+local Public = require 'maps.mountain_fortress_v3.table'
 local ICW = require 'maps.mountain_fortress_v3.icw.main'
-local WPT = require 'maps.mountain_fortress_v3.table'
 local WD = require 'modules.wave_defense.table'
 local Session = require 'utils.datastore.session_data'
 local Difficulty = require 'modules.difficulty_vote_by_amount'
@@ -11,12 +10,9 @@ local Server = require 'utils.server'
 local Alert = require 'utils.alert'
 local Math2D = require 'math2d'
 local SpamProtection = require 'utils.spam_protection'
-local MysticalChest = require 'maps.mountain_fortress_v3.mystical_chest'
-local FriendlyPet = require 'maps.mountain_fortress_v3.locomotive.friendly_pet'
 
 local format_number = require 'util'.format_number
 
-local Public = {}
 local concat = table.concat
 
 local main_frame_name = Gui.uid_name()
@@ -45,11 +41,11 @@ local function add_space(frame)
 end
 
 local function get_items()
-    local market_limits = WPT.get('market_limits')
-    local main_market_items = WPT.get('main_market_items')
-    local flame_turret = WPT.get('upgrades').flame_turret.bought
-    local upgrades = WPT.get('upgrades')
-    local fixed_prices = WPT.get('marked_fixed_prices')
+    local market_limits = Public.get('market_limits')
+    local main_market_items = Public.get('main_market_items')
+    local flame_turret = Public.get('upgrades').flame_turret.bought
+    local upgrades = Public.get('upgrades')
+    local fixed_prices = Public.get('marked_fixed_prices')
 
     local chests_outside_cost = round(fixed_prices.chests_outside_cost * (1 + upgrades.chests_outside_upgrades))
     local health_cost = round(fixed_prices.health_cost * (1 + upgrades.health_upgrades))
@@ -62,7 +58,7 @@ local function get_items()
     local land_mine_cost = round(fixed_prices.land_mine_cost * (1 + upgrades.landmine.bought))
     local car_health_upgrade_pool = fixed_prices.car_health_upgrade_pool_cost
 
-    local pickaxe_upgrades = WPT.pickaxe_upgrades
+    local pickaxe_upgrades = Public.pickaxe_upgrades
 
     local offer = pickaxe_upgrades[upgrades.pickaxe_tier]
 
@@ -493,7 +489,7 @@ local function validate_player(player)
 end
 
 local function close_market_gui(player)
-    local players = WPT.get('players')
+    local players = Public.get('players')
 
     local element = player.gui.screen
     local data = players[player.index].data
@@ -512,7 +508,7 @@ local function redraw_market_items(gui, player, search_text)
     if not validate_player(player) then
         return
     end
-    local players = WPT.get('players')
+    local players = Public.get('players')
     if not players then
         return
     end
@@ -630,7 +626,7 @@ local function redraw_market_items(gui, player, search_text)
                     enabled = data.enabled
                 }
             )
-            if WPT.get('trusted_only_car_tanks') then
+            if Public.get('trusted_only_car_tanks') then
                 local trustedPlayer = Session.get_trusted_player(player)
                 if not trustedPlayer then
                     if item == 'tank' then
@@ -683,7 +679,7 @@ end
 
 local function slider_changed(event)
     local player = game.players[event.player_index]
-    local players = WPT.get('players')
+    local players = Public.get('players')
     if not players then
         return
     end
@@ -726,7 +722,7 @@ local function text_changed(event)
         return
     end
 
-    local players = WPT.get('players')
+    local players = Public.get('players')
     if not players then
         return
     end
@@ -771,7 +767,7 @@ local function text_changed(event)
 end
 
 local function gui_opened(event)
-    local market = WPT.get('market')
+    local market = Public.get('market')
 
     if not event.gui_type == defines.gui_type.entity then
         return
@@ -795,7 +791,7 @@ local function gui_opened(event)
     local inventory = player.get_main_inventory()
     local player_item_count = inventory.get_item_count('coin')
 
-    local players = WPT.get('players')
+    local players = Public.get('players')
     if not players then
         return
     end
@@ -889,7 +885,7 @@ local function gui_opened(event)
 end
 
 local function gui_click(event)
-    local players = WPT.get('players')
+    local players = Public.get('players')
     if not players then
         return
     end
@@ -941,13 +937,13 @@ local function gui_click(event)
     local cost = (item.price * slider_value)
     local item_count = item.stack * slider_value
 
-    local this = WPT.get()
+    local this = Public.get()
     if name == 'upgrade_pickaxe' then
         player.remove_item({name = item.value, count = item.price})
 
         this.upgrades.pickaxe_tier = this.upgrades.pickaxe_tier + item.stack
 
-        local pickaxe_upgrades = WPT.pickaxe_upgrades
+        local pickaxe_upgrades = Public.pickaxe_upgrades
         local offer = pickaxe_upgrades[this.upgrades.pickaxe_tier]
 
         local message = ({
@@ -1122,7 +1118,7 @@ local function gui_click(event)
             }
         )
 
-        MysticalChest.init_price_check(this.locomotive, this.mystical_chest)
+        Public.init_price_check(this.locomotive, this.mystical_chest)
 
         redraw_market_items(data.item_frame, player, data.search_text)
         redraw_coins_left(data.coins_left, player)
@@ -1274,7 +1270,7 @@ end
 
 local function gui_closed(event)
     local player = game.players[event.player_index]
-    local players = WPT.get('players')
+    local players = Public.get('players')
     if not players then
         return
     end
@@ -1291,7 +1287,7 @@ local function gui_closed(event)
 end
 
 local function on_player_changed_position(event)
-    local players = WPT.get('players')
+    local players = Public.get('players')
     if not players then
         return
     end
@@ -1301,7 +1297,7 @@ local function on_player_changed_position(event)
     end
     local data = players[player.index].data
 
-    local market = WPT.get('market')
+    local market = Public.get('market')
 
     if not (market and market.valid) then
         return
@@ -1325,7 +1321,7 @@ end
 
 local function create_market(data, rebuild)
     local surface = data.surface
-    local this = WPT.get()
+    local this = Public.get()
 
     if not this.locomotive then
         return
@@ -1398,7 +1394,7 @@ local function create_market(data, rebuild)
         this.mystical_chest.entity.minable = false
         this.mystical_chest.entity.destructible = false
         if not this.mystical_chest.price then
-            MysticalChest.add_mystical_chest()
+            Public.add_mystical_chest()
         end
         rendering.draw_text {
             text = 'Mystical chest',
@@ -1411,7 +1407,7 @@ local function create_market(data, rebuild)
         }
     end
 
-    Generate.wintery(this.market, 5.5)
+    Public.wintery(this.market, 5.5)
 
     rendering.draw_text {
         text = 'Market',
@@ -1425,7 +1421,7 @@ local function create_market(data, rebuild)
 
     this.market.destructible = false
 
-    FriendlyPet.spawn_biter()
+    Public.spawn_biter()
 
     for x = center_position.x - 5, center_position.x + 5, 1 do
         for y = center_position.y - 5, center_position.y + 5, 1 do
@@ -1446,7 +1442,7 @@ local function create_market(data, rebuild)
 end
 
 local function place_market()
-    local locomotive = WPT.get('locomotive')
+    local locomotive = Public.get('locomotive')
     if not locomotive then
         return
     end
@@ -1458,7 +1454,7 @@ local function place_market()
     local icw_table = ICW.get_table()
     local unit_surface = locomotive.unit_number
     local surface = game.surfaces[icw_table.wagons[unit_surface].surface.index]
-    local market = WPT.get('market')
+    local market = Public.get('market')
 
     local data = {
         surface = surface
@@ -1488,7 +1484,7 @@ function Public.refresh_gui()
         local gui = player.gui
         local screen = gui.screen
 
-        local player_data = WPT.get('players')
+        local player_data = Public.get('players')
         if not players then
             return
         end
diff --git a/maps/mountain_fortress_v3/locomotive/permission_groups.lua b/maps/mountain_fortress_v3/locomotive/permission_groups.lua
index 86614bcc..b2ff8c70 100644
--- a/maps/mountain_fortress_v3/locomotive/permission_groups.lua
+++ b/maps/mountain_fortress_v3/locomotive/permission_groups.lua
@@ -1,4 +1,4 @@
-local WPT = require 'maps.mountain_fortress_v3.table'
+local Public = require 'maps.mountain_fortress_v3.table'
 local Session = require 'utils.datastore.session_data'
 local Jailed = require 'utils.datastore.jail_data'
 
@@ -6,17 +6,23 @@ local Antigrief = require 'utils.antigrief'
 
 local required_playtime = 5184000 -- 24 hours
 
-local Public = {}
-
 function Public.add_player_to_permission_group(player, group, forced)
     local jailed = Jailed.get_jailed_table()
-    local enable_permission_group_disconnect = WPT.get('disconnect_wagon')
+    local enable_permission_group_disconnect = Public.get('disconnect_wagon')
     local session = Session.get_session_table()
     local AG = Antigrief.get()
-    local allow_decon = WPT.get('allow_decon')
-    local allow_decon_main_surface = WPT.get('allow_decon_main_surface')
+    if not AG then
+        return
+    end
+
+    local allow_decon = Public.get('allow_decon')
+    local allow_decon_main_surface = Public.get('allow_decon_main_surface')
 
     local default_group = game.permissions.get_group('Default')
+    if not default_group then
+        return
+    end
+
     default_group.set_allows_action(defines.input_action.activate_cut, false)
     if allow_decon_main_surface then
         default_group.set_allows_action(defines.input_action.deconstruct, true)
@@ -26,6 +32,9 @@ function Public.add_player_to_permission_group(player, group, forced)
 
     if not game.permissions.get_group('limited') then
         local limited_group = game.permissions.create_group('limited')
+        if not limited_group then
+            return
+        end
         limited_group.set_allows_action(defines.input_action.cancel_craft, false)
         limited_group.set_allows_action(defines.input_action.drop_item, false)
         if allow_decon then
@@ -38,6 +47,9 @@ function Public.add_player_to_permission_group(player, group, forced)
 
     if not game.permissions.get_group('near_locomotive') then
         local near_locomotive_group = game.permissions.create_group('near_locomotive')
+        if not near_locomotive_group then
+            return
+        end
         near_locomotive_group.set_allows_action(defines.input_action.cancel_craft, false)
         near_locomotive_group.set_allows_action(defines.input_action.drop_item, false)
         if allow_decon_main_surface then
@@ -50,6 +62,9 @@ function Public.add_player_to_permission_group(player, group, forced)
 
     if not game.permissions.get_group('main_surface') then
         local main_surface_group = game.permissions.create_group('main_surface')
+        if not main_surface_group then
+            return
+        end
         if allow_decon_main_surface then
             main_surface_group.set_allows_action(defines.input_action.deconstruct, true)
         else
@@ -60,6 +75,9 @@ function Public.add_player_to_permission_group(player, group, forced)
 
     if not game.permissions.get_group('not_trusted') then
         local not_trusted = game.permissions.create_group('not_trusted')
+        if not not_trusted then
+            return
+        end
         not_trusted.set_allows_action(defines.input_action.cancel_craft, false)
         not_trusted.set_allows_action(defines.input_action.edit_permission_group, false)
         not_trusted.set_allows_action(defines.input_action.import_permissions_string, false)
@@ -149,18 +167,33 @@ function Public.add_player_to_permission_group(player, group, forced)
 
     if playtime < required_playtime then
         local not_trusted = game.permissions.get_group('not_trusted')
+        if not not_trusted then
+            return
+        end
+
         if not player.admin then
             not_trusted.add_player(player)
         end
     else
         if group == 'limited' then
             local limited_group = game.permissions.get_group('limited')
+            if not limited_group then
+                return
+            end
             limited_group.add_player(player)
         elseif group == 'main_surface' then
             local main_surface_group = game.permissions.get_group('main_surface')
+            if not main_surface_group then
+                return
+            end
+
             main_surface_group.add_player(player)
         elseif group == 'near_locomotive' then
             local near_locomotive_group = game.permissions.get_group('near_locomotive')
+            if not near_locomotive_group then
+                return
+            end
+
             near_locomotive_group.add_player(player)
         elseif group == 'default' then
             default_group.add_player(player)
diff --git a/maps/mountain_fortress_v3/locomotive/spawn_locomotive.lua b/maps/mountain_fortress_v3/locomotive/spawn_locomotive.lua
index e6042d7d..8779c80c 100644
--- a/maps/mountain_fortress_v3/locomotive/spawn_locomotive.lua
+++ b/maps/mountain_fortress_v3/locomotive/spawn_locomotive.lua
@@ -1,12 +1,9 @@
-local Generate = require 'maps.mountain_fortress_v3.generate'
+local Public = require 'maps.mountain_fortress_v3.table'
 local ICW = require 'maps.mountain_fortress_v3.icw.main'
-local WPT = require 'maps.mountain_fortress_v3.table'
 local Task = require 'utils.task'
 local Token = require 'utils.token'
 local MapFunctions = require 'tools.map_functions'
 
-local Public = {}
-
 local random = math.random
 
 local function initial_cargo_boxes()
@@ -113,7 +110,7 @@ local set_loco_tiles =
 )
 
 function Public.locomotive_spawn(surface, position)
-    local this = WPT.get()
+    local this = Public.get()
     for y = -6, 6, 2 do
         surface.create_entity({name = 'straight-rail', position = {position.x, position.y + y}, force = 'player', direction = 0})
     end
@@ -123,7 +120,7 @@ function Public.locomotive_spawn(surface, position)
     this.locomotive_cargo = surface.create_entity({name = 'cargo-wagon', position = {position.x, position.y + 3}, force = 'player'})
     this.locomotive_cargo.get_inventory(defines.inventory.cargo_wagon).insert({name = 'raw-fish', count = 8})
 
-    local winter_mode_locomotive = Generate.wintery(this.locomotive, 5.5)
+    local winter_mode_locomotive = Public.wintery(this.locomotive, 5.5)
     if not winter_mode_locomotive then
         rendering.draw_light(
             {
@@ -141,7 +138,7 @@ function Public.locomotive_spawn(surface, position)
         )
     end
 
-    local winter_mode_cargo = Generate.wintery(this.locomotive_cargo, 5.5)
+    local winter_mode_cargo = Public.wintery(this.locomotive_cargo, 5.5)
 
     if not winter_mode_cargo then
         rendering.draw_light(
@@ -165,7 +162,7 @@ function Public.locomotive_spawn(surface, position)
         position = position
     }
 
-    Task.set_timeout_in_ticks(100, set_loco_tiles, data)
+    Task.set_timeout_in_ticks(150, set_loco_tiles, data)
 
     for y = -1, 0, 0.05 do
         local scale = random(50, 100) * 0.01
@@ -190,6 +187,10 @@ function Public.locomotive_spawn(surface, position)
     this.locomotive_cargo.operable = true
 
     local locomotive = ICW.register_wagon(this.locomotive)
+    if not locomotive then
+        return
+    end
+
     ICW.register_wagon(this.locomotive_cargo)
 
     this.icw_locomotive = locomotive
diff --git a/maps/mountain_fortress_v3/loot.lua b/maps/mountain_fortress_v3/loot.lua
index 305628c7..20490137 100644
--- a/maps/mountain_fortress_v3/loot.lua
+++ b/maps/mountain_fortress_v3/loot.lua
@@ -1,6 +1,5 @@
 local LootRaffle = require 'functions.loot_raffle'
-
-local Public = {}
+local Public = require 'maps.mountain_fortress_v3.table'
 local random = math.random
 local abs = math.abs
 local floor = math.floor
@@ -27,7 +26,7 @@ function Public.get_distance(position)
     return difficulty
 end
 
-function Public.add(surface, position, chest)
+function Public.add_loot(surface, position, chest)
     local budget = 48 + abs(position.y) * 1.75
     budget = budget * random(25, 175) * 0.01
 
@@ -79,7 +78,7 @@ function Public.add(surface, position, chest)
     end
 end
 
-function Public.add_rare(surface, position, chest, magic)
+function Public.add_loot_rare(surface, position, chest, magic)
     local budget = magic * 48 + abs(position.y) * 1.75
     budget = budget * random(25, 175) * 0.01
 
diff --git a/maps/mountain_fortress_v3/main.lua b/maps/mountain_fortress_v3/main.lua
index 4fe0aed9..883ada92 100644
--- a/maps/mountain_fortress_v3/main.lua
+++ b/maps/mountain_fortress_v3/main.lua
@@ -5,30 +5,20 @@ Mountain Fortress v3 is maintained by Gerkiz and hosted by Comfy.
 Want to host it? Ask Gerkiz#0001 at discord!
 
 ]]
-local Functions = require 'maps.mountain_fortress_v3.functions'
-local BuriedEnemies = require 'maps.mountain_fortress_v3.buried_enemies'
-
--- local HS = require 'maps.mountain_fortress_v3.highscore'
+local Event = require 'utils.event'
+local Public = require 'maps.mountain_fortress_v3.core'
 local Discord = require 'utils.discord'
 local IC = require 'maps.mountain_fortress_v3.ic.table'
 local ICMinimap = require 'maps.mountain_fortress_v3.ic.minimap'
 local Autostash = require 'modules.autostash'
 local Group = require 'utils.gui.group'
 local PL = require 'utils.gui.player_list'
-local CS = require 'maps.mountain_fortress_v3.surface'
 local Server = require 'utils.server'
 local Explosives = require 'modules.explosives'
-local Balance = require 'maps.mountain_fortress_v3.balance'
-local Entities = require 'maps.mountain_fortress_v3.entities'
-local Gui_mf = require 'maps.mountain_fortress_v3.gui'
 local ICW = require 'maps.mountain_fortress_v3.icw.main'
 local WD = require 'modules.wave_defense.table'
 local Map = require 'modules.map_info'
 local RPG = require 'modules.rpg.main'
-local Event = require 'utils.event'
-local WPT = require 'maps.mountain_fortress_v3.table'
-local Locomotive = require 'maps.mountain_fortress_v3.locomotive'
-local SpawnLocomotive = require 'maps.mountain_fortress_v3.locomotive.spawn_locomotive'
 local Score = require 'utils.gui.score'
 local Poll = require 'utils.gui.poll'
 local Collapse = require 'modules.collapse'
@@ -45,16 +35,6 @@ local JailData = require 'utils.datastore.jail_data'
 local RPG_Progression = require 'utils.datastore.rpg_data'
 local OfflinePlayers = require 'modules.clear_vacant_players'
 
-require 'maps.mountain_fortress_v3.locomotive.market'
-require 'maps.mountain_fortress_v3.locomotive.linked_chests'
-require 'maps.mountain_fortress_v3.rocks_yield_ore_veins'
-
-require 'maps.mountain_fortress_v3.generate'
-require 'maps.mountain_fortress_v3.commands'
-require 'maps.mountain_fortress_v3.breached_wall'
-require 'maps.mountain_fortress_v3.ic.main'
-require 'maps.mountain_fortress_v3.biters_yield_coins'
-
 require 'modules.shotgun_buff'
 require 'modules.no_deconstruction_of_neutral_entities'
 require 'modules.spawners_contain_biters'
@@ -69,9 +49,6 @@ local role_to_mention = Discord.role_mentions.mtn_fortress
 -- local send_ping_to_channel = Discord.channel_names.bot_quarters
 -- local role_to_mention = Discord.role_mentions.test_role
 
-local Public = {}
-
-local raise_event = script.raise_event
 local floor = math.floor
 local remove = table.remove
 RPG.disable_cooldowns_on_spells()
@@ -142,27 +119,27 @@ local announce_new_map =
 )
 
 function Public.reset_map()
-    local this = WPT.get()
+    local this = Public.get()
     local wave_defense_table = WD.get_table()
     Misc.set('creative_are_you_sure', false)
     Misc.set('creative_enabled', false)
 
-    this.active_surface_index = CS.create_surface()
-    -- this.soft_reset_counter = CS.get_reset_counter()
+    this.active_surface_index = Public.create_surface()
+    -- this.soft_reset_counter = Public.get_reset_counter()
 
     Autostash.insert_into_furnace(true)
     Autostash.insert_into_wagon(true)
     Autostash.bottom_button(true)
     BottomFrame.reset()
     BottomFrame.activate_custom_buttons(true)
-    BuriedEnemies.reset()
+    Public.reset_buried_biters()
     Poll.reset()
     ICW.reset()
     IC.reset()
     IC.allowed_surface(game.surfaces[this.active_surface_index].name)
-    Functions.reset_table()
+    Public.reset_func_table()
     game.reset_time_played()
-    WPT.reset_table()
+    Public.reset_main_table()
 
     OfflinePlayers.set_active_surface_index(this.active_surface_index)
     OfflinePlayers.set_offline_players_enabled(true)
@@ -185,14 +162,14 @@ function Public.reset_map()
     RPG_Progression.toggle_module(false)
     RPG_Progression.set_dataset('mtn_v3_rpg_prestige')
 
-    if WPT.get('prestige_system_enabled') then
+    if Public.get('prestige_system_enabled') then
         RPG_Progression.restore_xp_on_reset()
     end
 
     Group.reset_groups()
     Group.alphanumeric_only(false)
 
-    Functions.disable_tech()
+    Public.disable_tech()
     init_protectors_force()
     init_bonus_drill_force()
 
@@ -219,7 +196,7 @@ function Public.reset_map()
     BiterHealthBooster.enable_boss_loot(false)
     BiterHealthBooster.enable_randomize_stun_and_slowdown_sticker(true)
 
-    Balance.init_enemy_weapon_damage()
+    Public.init_enemy_weapon_damage()
 
     AntiGrief.whitelist_types('tree', true)
     AntiGrief.enable_capsule_warning(false)
@@ -245,7 +222,7 @@ function Public.reset_map()
             player.gui.left['mvps'].destroy()
         end
         ICMinimap.kill_minimap(player)
-        raise_event(Gui_mf.events.reset_map, {player_index = player.index})
+        Event.raise(Public.events.reset_map, {player_index = player.index})
     end
 
     Difficulty.reset_difficulty_poll({closing_timeout = game.tick + 36000})
@@ -265,9 +242,9 @@ function Public.reset_map()
     this.locomotive_health = 10000
     this.locomotive_max_health = 10000
 
-    SpawnLocomotive.locomotive_spawn(surface, {x = -18, y = 25})
-    Locomotive.render_train_hp()
-    Functions.render_direction(surface)
+    Public.locomotive_spawn(surface, {x = -18, y = 25})
+    Public.render_train_hp()
+    Public.render_direction(surface)
 
     WD.reset_wave_defense()
     wave_defense_table.surface_index = this.active_surface_index
@@ -284,8 +261,8 @@ function Public.reset_map()
     WD.increase_damage_per_wave(true)
     WD.increase_health_per_wave(true)
 
-    Functions.set_difficulty()
-    Functions.disable_creative()
+    Public.set_difficulty()
+    Public.disable_creative()
 
     if not surface.is_chunk_generated({-20, 22}) then
         surface.request_to_generate_chunks({-20, 22}, 0.1)
@@ -296,9 +273,9 @@ function Public.reset_map()
 
     Task.set_queue_speed(16)
 
-    -- HS.get_scores()
+    -- Public.get_scores()
 
-    this.chunk_load_tick = game.tick + 200
+    this.chunk_load_tick = game.tick + 400
     this.force_chunk = true
     this.market_announce = game.tick + 1200
     this.game_lost = false
@@ -307,10 +284,10 @@ function Public.reset_map()
 end
 
 local is_locomotive_valid = function()
-    local locomotive = WPT.get('locomotive')
-    if not locomotive.valid then
-        WPT.set('game_lost', true)
-        Entities.loco_died(true)
+    local locomotive = Public.get('locomotive')
+    if not locomotive or not locomotive.valid then
+        Public.set('game_lost', true)
+        Public.loco_died(true)
     end
 end
 
@@ -326,13 +303,13 @@ local is_player_valid = function()
 end
 
 local has_the_game_ended = function()
-    local game_reset_tick = WPT.get('game_reset_tick')
+    local game_reset_tick = Public.get('game_reset_tick')
     if game_reset_tick then
         if game_reset_tick < 0 then
             return
         end
 
-        local this = WPT.get()
+        local this = Public.get()
 
         this.game_reset_tick = this.game_reset_tick - 30
         if this.game_reset_tick % 1800 == 0 then
@@ -353,14 +330,14 @@ local has_the_game_ended = function()
 
             if this.soft_reset and this.game_reset_tick == 0 then
                 this.game_reset_tick = nil
-                -- HS.set_scores(diff_name)
+                -- Public.set_scores(diff_name)
                 Public.reset_map()
                 return
             end
 
             if this.restart and this.game_reset_tick == 0 then
                 if not this.announced_message then
-                    -- HS.set_scores(diff_name)
+                    -- Public.set_scores(diff_name)
                     game.print(({'entity.notify_restart'}), {r = 0.22, g = 0.88, b = 0.22})
                     local message = 'Soft-reset is disabled! Server will restart from scenario to load new changes.'
                     Server.to_discord_bold(table.concat {'*** ', message, ' ***'})
@@ -371,7 +348,7 @@ local has_the_game_ended = function()
             end
             if this.shutdown and this.game_reset_tick == 0 then
                 if not this.announced_message then
-                    -- HS.set_scores(diff_name)
+                    -- Public.set_scores(diff_name)
                     game.print(({'entity.notify_shutdown'}), {r = 0.22, g = 0.88, b = 0.22})
                     local message = 'Soft-reset is disabled! Server will shutdown. Most likely because of updates.'
                     Server.to_discord_bold(table.concat {'*** ', message, ' ***'})
@@ -385,12 +362,12 @@ local has_the_game_ended = function()
 end
 
 local chunk_load = function()
-    local chunk_load_tick = WPT.get('chunk_load_tick')
+    local chunk_load_tick = Public.get('chunk_load_tick')
     local tick = game.tick
     if chunk_load_tick then
         if chunk_load_tick < tick then
-            WPT.set('force_chunk', false)
-            WPT.remove('chunk_load_tick')
+            Public.set('force_chunk', false)
+            Public.remove('chunk_load_tick')
             Task.set_queue_speed(8)
         end
     end
@@ -409,12 +386,12 @@ local collapse_message =
 )
 
 local lock_locomotive_positions = function()
-    local locomotive = WPT.get('locomotive')
+    local locomotive = Public.get('locomotive')
     if not locomotive or not locomotive.valid then
         return
     end
 
-    local locomotive_positions = WPT.get('locomotive_pos')
+    local locomotive_positions = Public.get('locomotive_pos')
     local success = is_position_near_tbl(locomotive.position, locomotive_positions.tbl)
     local p = locomotive.position
     if not success then
@@ -429,7 +406,7 @@ end
 
 local compare_collapse_and_train = function()
     local collapse_pos = Collapse.get_position()
-    local locomotive = WPT.get('locomotive')
+    local locomotive = Public.get('locomotive')
     if not (locomotive and locomotive.valid) then
         return
     end
@@ -437,10 +414,10 @@ local compare_collapse_and_train = function()
     local c_y = collapse_pos.y
     local t_y = locomotive.position.y
 
-    local gap_between_zones = WPT.get('gap_between_zones')
+    local gap_between_zones = Public.get('gap_between_zones')
 
     if c_y - t_y <= gap_between_zones.gap then
-        Functions.set_difficulty()
+        Public.set_difficulty()
     else
         Collapse.set_speed(1)
         Collapse.set_amount(4)
@@ -448,7 +425,7 @@ local compare_collapse_and_train = function()
 end
 
 local collapse_after_wave_200 = function()
-    local collapse_grace = WPT.get('collapse_grace')
+    local collapse_grace = Public.get('collapse_grace')
     if not collapse_grace then
         return
     end
@@ -469,13 +446,13 @@ local collapse_after_wave_200 = function()
 end
 
 local handle_changes = function()
-    WPT.set('restart', true)
-    WPT.set('soft_reset', false)
+    Public.set('restart', true)
+    Public.set('soft_reset', false)
     print('Received new changes from backend.')
 end
 
 local on_tick = function()
-    local update_gui = Gui_mf.update_gui
+    local update_gui = Public.update_gui
     local tick = game.tick
     local players = game.connected_players
 
@@ -493,14 +470,14 @@ local on_tick = function()
 
     if tick % 250 == 0 then
         compare_collapse_and_train()
-        Functions.set_spawn_position()
-        Functions.boost_difficulty()
+        Public.set_spawn_position()
+        Public.boost_difficulty()
     end
 
     if tick % 1000 == 0 then
         collapse_after_wave_200()
-        Functions.set_difficulty()
-        Functions.is_creativity_mode_on()
+        Public.set_difficulty()
+        Public.is_creativity_mode_on()
     end
 end
 
@@ -543,6 +520,5 @@ Event.add(Server.events.on_changes_detected, handle_changes)
 
 Event.on_nth_tick(10, on_tick)
 Event.on_init(on_init)
-Event.add(WPT.events.reset_map, Public.reset_map)
 
 return Public
diff --git a/maps/mountain_fortress_v3/mining.lua b/maps/mountain_fortress_v3/mining.lua
index 7baa70ca..c463d2fd 100644
--- a/maps/mountain_fortress_v3/mining.lua
+++ b/maps/mountain_fortress_v3/mining.lua
@@ -1,11 +1,9 @@
-local WPT = require 'maps.mountain_fortress_v3.table'
+local Public = require 'maps.mountain_fortress_v3.table'
 local RPG = require 'modules.rpg.main'
 local Event = require 'utils.event'
 local Ai = require 'modules.ai'
 require 'modules.check_fullness'
 
-local Public = {events = {on_entity_mined = Event.generate_event_name('on_entity_mined')}}
-
 local random = math.random
 local floor = math.floor
 local sqrt = math.sqrt
@@ -219,7 +217,7 @@ local size_of_scrap_raffle = #scrap_raffle
 
 local function get_amount(data)
     local entity = data.entity
-    local mining_utils = WPT.get('mining_utils')
+    local mining_utils = Public.get('mining_utils')
     local t_modifier = mining_utils.type_modifier
     local rocks_yield_ore_distance_modifier = mining_utils.rocks_yield_ore_distance_modifier
     local rocks_yield_ore_base_amount = mining_utils.rocks_yield_ore_base_amount
@@ -286,7 +284,7 @@ end
 local function randomness(data)
     local entity = data.entity
     local player = data.player
-    local spill_items_to_surface = WPT.get('spill_items_to_surface')
+    local spill_items_to_surface = Public.get('spill_items_to_surface')
     local harvest
     local harvest_amount
 
@@ -351,7 +349,7 @@ end
 local function randomness_scrap(data)
     local entity = data.entity
     local player = data.player
-    local spill_items_to_surface = WPT.get('spill_items_to_surface')
+    local spill_items_to_surface = Public.get('spill_items_to_surface')
 
     local harvest = scrap_raffle[random(1, size_of_scrap_raffle)]
     local amount_bonus = game.forces.player.mining_drill_productivity_bonus * 2
diff --git a/maps/mountain_fortress_v3/mystical_chest.lua b/maps/mountain_fortress_v3/mystical_chest.lua
index 85b6da58..95c47855 100644
--- a/maps/mountain_fortress_v3/mystical_chest.lua
+++ b/maps/mountain_fortress_v3/mystical_chest.lua
@@ -1,11 +1,10 @@
 local Color = require 'utils.color_presets'
 local Event = require 'utils.event'
-local WPT = require 'maps.mountain_fortress_v3.table'
+local Public = require 'maps.mountain_fortress_v3.table'
 local RPG = require 'modules.rpg.main'
 local Alert = require 'utils.alert'
 local Task = require 'utils.task'
 local Token = require 'utils.token'
-local Public = {}
 
 local shuffle = table.shuffle_table
 local random = math.random
@@ -267,7 +266,7 @@ end
 local restore_mining_speed_token =
     Token.register(
     function()
-        local mc_rewards = WPT.get('mc_rewards')
+        local mc_rewards = Public.get('mc_rewards')
         local force = game.forces.player
         if mc_rewards.temp_boosts.mining then
             force.manual_mining_speed_modifier = force.manual_mining_speed_modifier - 0.5
@@ -281,7 +280,7 @@ local restore_mining_speed_token =
 local restore_movement_speed_token =
     Token.register(
     function()
-        local mc_rewards = WPT.get('mc_rewards')
+        local mc_rewards = Public.get('mc_rewards')
         local force = game.forces.player
         if mc_rewards.temp_boosts.movement then
             force.character_running_speed_modifier = force.character_running_speed_modifier - 0.2
@@ -333,7 +332,7 @@ local mc_random_rewards = {
         color = {r = 0.00, g = 0.25, b = 0.00},
         tooltip = 'Selecting this will grant the team a bonus movement speed for 15 minutes!',
         func = (function(player)
-            local mc_rewards = WPT.get('mc_rewards')
+            local mc_rewards = Public.get('mc_rewards')
             local force = game.forces.player
             if mc_rewards.temp_boosts.movement then
                 return false, '[Rewards] Movement bonus is already applied. Please choose another reward.'
@@ -355,7 +354,7 @@ local mc_random_rewards = {
         color = {r = 0.00, g = 0.00, b = 0.25},
         tooltip = 'Selecting this will grant the team a bonus mining speed for 15 minutes!',
         func = (function(player)
-            local mc_rewards = WPT.get('mc_rewards')
+            local mc_rewards = Public.get('mc_rewards')
             local force = game.forces.player
             if mc_rewards.temp_boosts.mining then
                 return false, '[Rewards] Mining bonus is already applied. Please choose another reward.'
@@ -376,8 +375,8 @@ local mc_random_rewards = {
         color = {r = 0.00, g = 0.00, b = 0.25},
         tooltip = 'Selecting this will heal the main locomotive to full health!',
         func = (function(player)
-            local locomotive_max_health = WPT.get('locomotive_max_health')
-            WPT.set('locomotive_health', locomotive_max_health)
+            local locomotive_max_health = Public.get('locomotive_max_health')
+            Public.set('locomotive_health', locomotive_max_health)
             local message = ({'locomotive.locomotive_health', player.name})
             Alert.alert_all_players(15, message, nil, 'achievement/tech-maniac')
             return true
@@ -397,7 +396,7 @@ local function mystical_chest_reward(player)
     frame = frame.add {type = 'frame', name = 'reward_system_1', direction = 'vertical', style = 'inside_shallow_frame'}
     frame.style.padding = 4
 
-    local mc_rewards = WPT.get('mc_rewards')
+    local mc_rewards = Public.get('mc_rewards')
     mc_rewards.current = {}
 
     for i = 1, 3 do
@@ -437,7 +436,7 @@ local function container_opened(event)
         return
     end
 
-    local mystical_chest = WPT.get('mystical_chest')
+    local mystical_chest = Public.get('mystical_chest')
     if not mystical_chest then
         return
     end
@@ -480,7 +479,7 @@ local function on_gui_click(event)
     end
     local i = tonumber(element.name)
 
-    local mc_rewards = WPT.get('mc_rewards')
+    local mc_rewards = Public.get('mc_rewards')
     local current = mc_rewards.current
 
     local player = game.get_player(element.player_index)
@@ -566,7 +565,7 @@ function Public.roll(budget, max_slots, blacklist)
 end
 
 function Public.add_mystical_chest(player)
-    local locomotive = WPT.get('locomotive')
+    local locomotive = Public.get('locomotive')
     if not locomotive then
         return
     end
@@ -574,7 +573,7 @@ function Public.add_mystical_chest(player)
         return
     end
 
-    local mystical_chest = WPT.get('mystical_chest')
+    local mystical_chest = Public.get('mystical_chest')
     if not (mystical_chest.entity and mystical_chest.entity.valid) then
         return
     end
diff --git a/maps/mountain_fortress_v3/resource_generator.lua b/maps/mountain_fortress_v3/resource_generator.lua
index dc6fad48..8580fdf7 100644
--- a/maps/mountain_fortress_v3/resource_generator.lua
+++ b/maps/mountain_fortress_v3/resource_generator.lua
@@ -1,3 +1,4 @@
+local Public = require 'maps.mountain_fortress_v3.table'
 local Functions = require 'maps.mountain_fortress_v3.functions'
 
 local random = math.random
@@ -604,7 +605,7 @@ if testing then
     }
 end
 
-local function spawn_random_buildings(entities, p, depth)
+function Public.spawn_random_buildings(entities, p, depth)
     local randomizer = random(1, #buildings)
     local low = random(1, 2)
     local medium = random(2, 3)
@@ -650,4 +651,4 @@ local function spawn_random_buildings(entities, p, depth)
     end
 end
 
-return spawn_random_buildings
+return Public
diff --git a/maps/mountain_fortress_v3/rocks_yield_ore_veins.lua b/maps/mountain_fortress_v3/rocks_yield_ore_veins.lua
index ecebf0c6..810f3cac 100644
--- a/maps/mountain_fortress_v3/rocks_yield_ore_veins.lua
+++ b/maps/mountain_fortress_v3/rocks_yield_ore_veins.lua
@@ -1,4 +1,5 @@
 local Event = require 'utils.event'
+local Public = require 'maps.mountain_fortress_v3.table'
 local Global = require 'utils.global'
 
 local random = math.random
@@ -181,3 +182,5 @@ end
 
 Event.on_init(on_init)
 Event.add(defines.events.on_player_mined_entity, on_player_mined_entity)
+
+return Public
diff --git a/maps/mountain_fortress_v3/soft_reset.lua b/maps/mountain_fortress_v3/soft_reset.lua
index 671c8733..72e2fbc9 100644
--- a/maps/mountain_fortress_v3/soft_reset.lua
+++ b/maps/mountain_fortress_v3/soft_reset.lua
@@ -1,11 +1,21 @@
 local Server = require 'utils.server'
 local Session = require 'utils.datastore.session_data'
 local Modifers = require 'utils.player_modifiers'
-local WPT = require 'maps.mountain_fortress_v3.table'
+local Public = require 'maps.mountain_fortress_v3.table'
 
 local mapkeeper = '[color=blue]Mapkeeper:[/color]'
 
-local Public = {}
+local function show_all_gui(player)
+    for _, child in pairs(player.gui.top.children) do
+        child.visible = true
+    end
+end
+
+local function clear_spec_tag(player)
+    if player.tag == '[Spectator]' then
+        player.tag = ''
+    end
+end
 
 local function reset_forces(new_surface, old_surface)
     for _, f in pairs(game.forces) do
@@ -52,6 +62,8 @@ local function equip_players(player_starting_items, data)
             for item, amount in pairs(player_starting_items) do
                 player.insert({name = item, count = amount})
             end
+            show_all_gui(player)
+            clear_spec_tag(player)
         else
             data.players[player.index] = nil
             Session.clear_player(player)
@@ -61,7 +73,7 @@ local function equip_players(player_starting_items, data)
 end
 
 function Public.soft_reset_map(old_surface, map_gen_settings, player_starting_items)
-    local this = WPT.get()
+    local this = Public.get()
 
     if not this.soft_reset_counter then
         this.soft_reset_counter = 0
@@ -72,7 +84,7 @@ function Public.soft_reset_map(old_surface, map_gen_settings, player_starting_it
     this.soft_reset_counter = this.soft_reset_counter + 1
 
     local new_surface = game.create_surface(this.original_surface_name .. '_' .. tostring(this.soft_reset_counter), map_gen_settings)
-    new_surface.request_to_generate_chunks({0, 0}, 0.5)
+    new_surface.request_to_generate_chunks({0, 0}, 0.1)
     new_surface.force_generate_chunk_requests()
 
     reset_forces(new_surface, old_surface)
diff --git a/maps/mountain_fortress_v3/surface.lua b/maps/mountain_fortress_v3/surface.lua
index f0d68504..ad7c7100 100644
--- a/maps/mountain_fortress_v3/surface.lua
+++ b/maps/mountain_fortress_v3/surface.lua
@@ -1,10 +1,7 @@
 local Global = require 'utils.global'
 local surface_name = 'mtn_v3'
-local WPT = require 'maps.mountain_fortress_v3.table'
-local Reset = require 'maps.mountain_fortress_v3.soft_reset'
-local zone_settings = WPT.zone_settings
-
-local Public = {}
+local Public = require 'maps.mountain_fortress_v3.table'
+local zone_settings = Public.zone_settings
 
 local this = {
     active_surface_index = nil,
@@ -59,10 +56,10 @@ function Public.create_surface()
     if not this.active_surface_index then
         this.active_surface_index = game.create_surface(surface_name, map_gen_settings).index
     else
-        this.active_surface_index = Reset.soft_reset_map(game.surfaces[this.active_surface_index], map_gen_settings, starting_items).index
+        this.active_surface_index = Public.soft_reset_map(game.surfaces[this.active_surface_index], map_gen_settings, starting_items).index
     end
 
-    -- this.soft_reset_counter = Reset.get_reset_counter()
+    -- this.soft_reset_counter = Public.get_reset_counter()
 
     if not this.cleared_nauvis then
         local mgs = game.surfaces['nauvis'].map_gen_settings
@@ -91,12 +88,4 @@ function Public.get_reset_counter()
     return this.soft_reset_counter
 end
 
-function Public.get(key)
-    if key then
-        return this[key]
-    else
-        return this
-    end
-end
-
 return Public
diff --git a/maps/mountain_fortress_v3/table.lua b/maps/mountain_fortress_v3/table.lua
index 1ab0d22f..12058e3e 100644
--- a/maps/mountain_fortress_v3/table.lua
+++ b/maps/mountain_fortress_v3/table.lua
@@ -8,7 +8,10 @@ local this = {
 }
 local Public = {}
 
-Public.events = {reset_map = Event.generate_event_name('reset_map')}
+Public.events = {
+    reset_map = Event.generate_event_name('reset_map'),
+    on_entity_mined = Event.generate_event_name('on_entity_mined')
+}
 
 Global.register(
     this,
@@ -84,7 +87,7 @@ Public.pickaxe_upgrades = {
     'Luminite'
 }
 
-function Public.reset_table()
+function Public.reset_main_table()
     -- @start
     -- these 3 are in case of stop/start/reloading the instance.
     this.soft_reset = true
@@ -174,6 +177,7 @@ function Public.reset_table()
     this.bonus_xp_on_join = 250
     this.main_market_items = {}
     this.spill_items_to_surface = false
+    this.spectate = {}
     this.outside_chests = {}
     this.chests_linked_to = {}
     this.placed_trains_in_zone = {
@@ -289,6 +293,6 @@ function Public.remove(key, sub_key)
     end
 end
 
-Event.on_init(Public.reset_table)
+Event.on_init(Public.reset_main_table)
 
 return Public
diff --git a/maps/mountain_fortress_v3/terrain.lua b/maps/mountain_fortress_v3/terrain.lua
index 811c0df7..c4c524c2 100644
--- a/maps/mountain_fortress_v3/terrain.lua
+++ b/maps/mountain_fortress_v3/terrain.lua
@@ -1,17 +1,13 @@
 local Event = require 'utils.event'
+local Public = require 'maps.mountain_fortress_v3.table'
 local Biters = require 'modules.wave_defense.biter_rolls'
-local Functions = require 'maps.mountain_fortress_v3.functions'
-local Generate_resources = require 'maps.mountain_fortress_v3.resource_generator'
-local WPT = require 'maps.mountain_fortress_v3.table'
-local get_perlin = require 'maps.mountain_fortress_v3.get_perlin'
 
-local Public = {}
 local random = math.random
 local abs = math.abs
 local floor = math.floor
 local ceil = math.ceil
 
-local zone_settings = WPT.zone_settings
+local zone_settings = Public.zone_settings
 local worm_level_modifier = 0.19
 
 local start_ground_tiles = {
@@ -97,12 +93,12 @@ local trees = {
 }
 
 local callback = {
-    [1] = {callback = Functions.refill_turret_callback, data = Functions.firearm_magazine_ammo},
-    [2] = {callback = Functions.refill_turret_callback, data = Functions.piercing_rounds_magazine_ammo},
-    [3] = {callback = Functions.refill_turret_callback, data = Functions.uranium_rounds_magazine_ammo},
-    [4] = {callback = Functions.refill_turret_callback, data = Functions.uranium_rounds_magazine_ammo},
-    [5] = {callback = Functions.refill_liquid_turret_callback, data = Functions.light_oil_ammo},
-    [6] = {callback = Functions.refill_artillery_turret_callback, data = Functions.artillery_shell_ammo}
+    [1] = {callback = Public.refill_turret_callback, data = Public.firearm_magazine_ammo},
+    [2] = {callback = Public.refill_turret_callback, data = Public.piercing_rounds_magazine_ammo},
+    [3] = {callback = Public.refill_turret_callback, data = Public.uranium_rounds_magazine_ammo},
+    [4] = {callback = Public.refill_turret_callback, data = Public.uranium_rounds_magazine_ammo},
+    [5] = {callback = Public.refill_liquid_turret_callback, data = Public.light_oil_ammo},
+    [6] = {callback = Public.refill_artillery_turret_callback, data = Public.artillery_shell_ammo}
 }
 
 local turret_list = {
@@ -162,11 +158,11 @@ local function is_position_near(area, table_to_check)
 end
 
 local function place_wagon(data, adjusted_zones)
-    local placed_trains_in_zone = WPT.get('placed_trains_in_zone')
+    local placed_trains_in_zone = Public.get('placed_trains_in_zone')
     if not placed_trains_in_zone.randomized then
         placed_trains_in_zone.limit = random(1, 2)
         placed_trains_in_zone.randomized = true
-        placed_trains_in_zone = WPT.get('placed_trains_in_zone')
+        placed_trains_in_zone = Public.get('placed_trains_in_zone')
     end
 
     if not data.new_zone then
@@ -205,11 +201,11 @@ local function place_wagon(data, adjusted_zones)
     local top_y = data.top_y
     local position = {x = data.x, y = top_y + random(4, 12) * 2}
     local wagon_mineable = {
-        callback = Functions.disable_minable_and_ICW_callback
+        callback = Public.disable_minable_and_ICW_callback
     }
 
     local rail_mineable = {
-        callback = Functions.disable_destructible_callback
+        callback = Public.disable_destructible_callback
     }
 
     local radius = 300
@@ -282,15 +278,15 @@ local function wall(p, data)
     local entities = data.entities
     local surface = data.surface
     local treasure = data.treasure
-    local stone_wall = {callback = Functions.disable_minable_callback}
-    local enable_arties = WPT.get('enable_arties')
-    local alert_zone_1 = WPT.get('alert_zone_1')
+    local stone_wall = {callback = Public.disable_minable_callback}
+    local enable_arties = Public.get('enable_arties')
+    local alert_zone_1 = Public.get('alert_zone_1')
 
     local seed = data.seed
     local y = data.yv
 
-    local small_caves = get_perlin('small_caves', p, seed + 204000)
-    local cave_ponds = get_perlin('cave_rivers', p, seed + 120400)
+    local small_caves = Public.get_noise('small_caves', p, seed + 204000)
+    local cave_ponds = Public.get_noise('cave_rivers', p, seed + 120400)
     if y > 9 + cave_ponds * 6 and y < 23 + small_caves * 6 then
         if small_caves > 0.02 or cave_ponds > 0.02 then
             if small_caves > 0.005 then
@@ -353,10 +349,10 @@ local function wall(p, data)
                         if not alert_zone_1 and data.y >= -zone_settings.zone_depth then
                             local x_min = -zone_settings.zone_width / 2
                             local x_max = zone_settings.zone_width / 2
-                            WPT.set('zone1_beam1', surface.create_entity({name = 'electric-beam', position = {x_min, p.y}, source = {x_min, p.y}, target = {x_max, p.y}}))
-                            WPT.set('zone1_beam2', surface.create_entity({name = 'electric-beam', position = {x_min, p.y}, source = {x_min, p.y}, target = {x_max, p.y}}))
-                            WPT.set('alert_zone_1', true)
-                            WPT.set(
+                            Public.set('zone1_beam1', surface.create_entity({name = 'electric-beam', position = {x_min, p.y}, source = {x_min, p.y}, target = {x_max, p.y}}))
+                            Public.set('zone1_beam2', surface.create_entity({name = 'electric-beam', position = {x_min, p.y}, source = {x_min, p.y}, target = {x_max, p.y}}))
+                            Public.set('alert_zone_1', true)
+                            Public.set(
                                 'zone1_text1',
                                 rendering.draw_text {
                                     text = 'Breaching the far side wall will start collapse.',
@@ -369,7 +365,7 @@ local function wall(p, data)
                                     scale_with_zoom = false
                                 }
                             )
-                            WPT.set(
+                            Public.set(
                                 'zone1_text2',
                                 rendering.draw_text {
                                     text = 'Breaching the far side wall will start collapse',
@@ -382,7 +378,7 @@ local function wall(p, data)
                                     scale_with_zoom = false
                                 }
                             )
-                            WPT.set(
+                            Public.set(
                                 'zone1_text3',
                                 rendering.draw_text {
                                     text = 'Breaching the far side wall will start collapse',
@@ -477,14 +473,14 @@ local function zone_14(x, y, data, _, adjusted_zones)
     local treasure = data.treasure
     data.forest_zone = true
 
-    local small_caves = get_perlin('small_caves', p, seed)
-    local noise_cave_ponds = get_perlin('cave_ponds', p, seed)
-    local smol_areas = get_perlin('smol_areas', p, seed + 40000)
+    local small_caves = Public.get_noise('small_caves', p, seed)
+    local noise_cave_ponds = Public.get_noise('cave_ponds', p, seed)
+    local smol_areas = Public.get_noise('smol_areas', p, seed + 40000)
 
     --Resource Spots
     if smol_areas < -0.71 then
         if random(1, 32) == 1 then
-            Generate_resources(buildings, p, zone_settings.zone_depth)
+            Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
         end
     end
 
@@ -557,14 +553,14 @@ local function zone_13(x, y, data, _, adjusted_zones)
     local buildings = data.buildings
     local treasure = data.treasure
 
-    local small_caves = get_perlin('small_caves', p, seed)
-    local noise_cave_ponds = get_perlin('cave_ponds', p, seed)
-    local smol_areas = get_perlin('smol_areas', p, seed + 70000)
+    local small_caves = Public.get_noise('small_caves', p, seed)
+    local noise_cave_ponds = Public.get_noise('cave_ponds', p, seed)
+    local smol_areas = Public.get_noise('smol_areas', p, seed + 70000)
 
     --Resource Spots
     if smol_areas < -0.72 then
         if random(1, 32) == 1 then
-            Generate_resources(buildings, p, zone_settings.zone_depth)
+            Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
         end
     end
 
@@ -638,14 +634,14 @@ local function zone_12(x, y, data, void_or_lab, adjusted_zones)
     local markets = data.markets
     local treasure = data.treasure
 
-    local noise_1 = get_perlin('small_caves', p, seed)
-    local noise_2 = get_perlin('no_rocks_2', p, seed + 20000)
-    local smol_areas = get_perlin('smol_areas', p, seed + 60000)
+    local noise_1 = Public.get_noise('small_caves', p, seed)
+    local noise_2 = Public.get_noise('no_rocks_2', p, seed + 20000)
+    local smol_areas = Public.get_noise('smol_areas', p, seed + 60000)
 
     --Resource Spots
     if smol_areas < -0.72 then
         if random(1, 32) == 1 then
-            Generate_resources(buildings, p, zone_settings.zone_depth)
+            Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
         end
     end
 
@@ -724,9 +720,9 @@ local function zone_11(x, y, data, _, adjusted_zones)
     local markets = data.markets
     local treasure = data.treasure
 
-    local noise_1 = get_perlin('small_caves', p, seed)
-    local noise_2 = get_perlin('no_rocks_2', p, seed + 10000)
-    local smol_areas = get_perlin('smol_areas', p, seed + 50000)
+    local noise_1 = Public.get_noise('small_caves', p, seed)
+    local noise_2 = Public.get_noise('no_rocks_2', p, seed + 10000)
+    local smol_areas = Public.get_noise('smol_areas', p, seed + 50000)
 
     if noise_1 > 0.7 then
         tiles[#tiles + 1] = {name = 'water', position = p}
@@ -739,7 +735,7 @@ local function zone_11(x, y, data, _, adjusted_zones)
     --Resource Spots
     if smol_areas < -0.72 then
         if random(1, 32) == 1 then
-            Generate_resources(buildings, p, zone_settings.zone_depth)
+            Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
         end
     end
 
@@ -783,7 +779,7 @@ local function zone_11(x, y, data, _, adjusted_zones)
         return
     end
 
-    local noise_forest_location = get_perlin('forest_location', p, seed)
+    local noise_forest_location = Public.get_noise('forest_location', p, seed)
     if noise_forest_location > 0.095 then
         if noise_forest_location > 0.6 then
             if random(1, 100) > 42 then
@@ -820,8 +816,8 @@ local function zone_10(x, y, data, _, adjusted_zones)
     local treasure = data.treasure
     data.forest_zone = true
 
-    local scrapyard = get_perlin('scrapyard', p, seed)
-    local smol_areas = get_perlin('smol_areas', p, seed + 45000)
+    local scrapyard = Public.get_noise('scrapyard', p, seed)
+    local smol_areas = Public.get_noise('smol_areas', p, seed + 45000)
 
     if scrapyard < -0.70 or scrapyard > 0.70 then
         tiles[#tiles + 1] = {name = 'grass-3', position = p}
@@ -838,7 +834,7 @@ local function zone_10(x, y, data, _, adjusted_zones)
     --Resource Spots
     if smol_areas < -0.72 then
         if random(1, 32) == 1 then
-            Generate_resources(buildings, p, zone_settings.zone_depth)
+            Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
         end
     end
 
@@ -875,7 +871,7 @@ local function zone_10(x, y, data, _, adjusted_zones)
         tiles[#tiles + 1] = {name = 'water-shallow', position = p}
         return
     end
-    local noise_forest_location = get_perlin('forest_location', p, seed)
+    local noise_forest_location = Public.get_noise('forest_location', p, seed)
     if scrapyard > -0.15 and scrapyard < 0.15 then
         if noise_forest_location > 0.095 then
             if random(1, 256) == 1 then
@@ -936,12 +932,12 @@ local function zone_9(x, y, data, _, adjusted_zones)
     local treasure = data.treasure
 
     local maze_p = {x = floor(p.x - p.x % 10), y = floor(p.y - p.y % 10)}
-    local maze_noise = get_perlin('no_rocks_2', maze_p, seed)
-    local smol_areas = get_perlin('smol_areas', p, seed + 40000)
+    local maze_noise = Public.get_noise('no_rocks_2', maze_p, seed)
+    local smol_areas = Public.get_noise('smol_areas', p, seed + 40000)
 
     if maze_noise > -0.35 and maze_noise < 0.35 then
         tiles[#tiles + 1] = {name = 'dirt-7', position = p}
-        local no_rocks_2 = get_perlin('no_rocks_2', p, seed)
+        local no_rocks_2 = Public.get_noise('no_rocks_2', p, seed)
         if random(1, 2) == 1 and no_rocks_2 > -0.5 then
             entities[#entities + 1] = {name = rock_raffle[random(1, size_of_rock_raffle)], position = p}
         end
@@ -980,7 +976,7 @@ local function zone_9(x, y, data, _, adjusted_zones)
     --Resource Spots
     if smol_areas < -0.72 then
         if random(1, 32) == 1 then
-            Generate_resources(buildings, p, zone_settings.zone_depth)
+            Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
         end
     end
 
@@ -1008,12 +1004,12 @@ local function zone_scrap_2(x, y, data, void_or_lab, adjusted_zones)
     local treasure = data.treasure
     data.scrap_zone = true
 
-    local scrapyard_modified = get_perlin('scrapyard_modified', p, seed)
-    local cave_rivers = get_perlin('cave_rivers', p, seed + 65030)
+    local scrapyard_modified = Public.get_noise('scrapyard_modified', p, seed)
+    local cave_rivers = Public.get_noise('cave_rivers', p, seed + 65030)
 
     --Chasms
-    local noise_cave_ponds = get_perlin('cave_ponds', p, seed)
-    local small_caves = get_perlin('small_caves', p, seed)
+    local noise_cave_ponds = Public.get_noise('cave_ponds', p, seed)
+    local small_caves = Public.get_noise('small_caves', p, seed)
     if noise_cave_ponds < 0.15 and noise_cave_ponds > -0.15 then
         if small_caves > 0.35 then
             tiles[#tiles + 1] = {name = void_or_lab, position = p}
@@ -1087,7 +1083,7 @@ local function zone_scrap_2(x, y, data, void_or_lab, adjusted_zones)
         return
     end
 
-    local cave_ponds = get_perlin('cave_ponds', p, seed)
+    local cave_ponds = Public.get_noise('cave_ponds', p, seed)
     if cave_ponds < -0.6 and scrapyard_modified > -0.2 and scrapyard_modified < 0.2 then
         tiles[#tiles + 1] = {name = 'deepwater-green', position = p}
         if random(1, 128) == 1 then
@@ -1099,11 +1095,11 @@ local function zone_scrap_2(x, y, data, void_or_lab, adjusted_zones)
     --Resource Spots
     if cave_rivers < -0.72 then
         if random(1, 32) == 1 then
-            Generate_resources(buildings, p, zone_settings.zone_depth)
+            Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
         end
     end
 
-    local large_caves = get_perlin('large_caves', p, seed)
+    local large_caves = Public.get_noise('large_caves', p, seed)
     if scrapyard_modified > -0.15 and scrapyard_modified < 0.15 then
         if floor(large_caves * 10) % 4 < 3 then
             tiles[#tiles + 1] = {name = 'dirt-7', position = p}
@@ -1137,12 +1133,12 @@ local function zone_scrap_1(x, y, data, void_or_lab, adjusted_zones)
     local treasure = data.treasure
     data.scrap_zone = true
 
-    local scrapyard = get_perlin('scrapyard', p, seed)
-    local smol_areas = get_perlin('smol_areas', p, seed + 35000)
+    local scrapyard = Public.get_noise('scrapyard', p, seed)
+    local smol_areas = Public.get_noise('smol_areas', p, seed + 35000)
 
     --Chasms
-    local noise_cave_ponds = get_perlin('cave_ponds', p, seed)
-    local small_caves = get_perlin('small_caves', p, seed)
+    local noise_cave_ponds = Public.get_noise('cave_ponds', p, seed)
+    local small_caves = Public.get_noise('small_caves', p, seed)
     if noise_cave_ponds < 0.15 and noise_cave_ponds > -0.15 then
         if small_caves > 0.35 then
             tiles[#tiles + 1] = {name = void_or_lab, position = p}
@@ -1216,7 +1212,7 @@ local function zone_scrap_1(x, y, data, void_or_lab, adjusted_zones)
         return
     end
 
-    local cave_ponds = get_perlin('cave_ponds', p, seed)
+    local cave_ponds = Public.get_noise('cave_ponds', p, seed)
     if cave_ponds < -0.6 and scrapyard > -0.2 and scrapyard < 0.2 then
         tiles[#tiles + 1] = {name = 'deepwater-green', position = p}
         if random(1, 128) == 1 then
@@ -1228,11 +1224,11 @@ local function zone_scrap_1(x, y, data, void_or_lab, adjusted_zones)
     --Resource Spots
     if smol_areas < -0.72 then
         if random(1, 32) == 1 then
-            Generate_resources(buildings, p, zone_settings.zone_depth)
+            Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
         end
     end
 
-    local large_caves = get_perlin('large_caves', p, seed)
+    local large_caves = Public.get_noise('large_caves', p, seed)
     if scrapyard > -0.15 and scrapyard < 0.15 then
         if floor(large_caves * 10) % 4 < 3 then
             tiles[#tiles + 1] = {name = 'dirt-7', position = p}
@@ -1265,10 +1261,10 @@ local function zone_7(x, y, data, void_or_lab, adjusted_zones)
     local markets = data.markets
     local treasure = data.treasure
 
-    local cave_rivers_3 = get_perlin('cave_rivers_3', p, seed)
-    local cave_rivers_4 = get_perlin('cave_rivers_4', p, seed + 50000)
-    local no_rocks_2 = get_perlin('no_rocks_2', p, seed)
-    local smol_areas = get_perlin('smol_areas', p, seed + 30000)
+    local cave_rivers_3 = Public.get_noise('cave_rivers_3', p, seed)
+    local cave_rivers_4 = Public.get_noise('cave_rivers_4', p, seed + 50000)
+    local no_rocks_2 = Public.get_noise('no_rocks_2', p, seed)
+    local smol_areas = Public.get_noise('smol_areas', p, seed + 30000)
 
     if cave_rivers_3 > -0.025 and cave_rivers_3 < 0.025 and no_rocks_2 > -0.6 then
         tiles[#tiles + 1] = {name = 'water', position = p}
@@ -1286,7 +1282,7 @@ local function zone_7(x, y, data, void_or_lab, adjusted_zones)
         return
     end
 
-    local noise_ores = get_perlin('no_rocks_2', p, seed + 25000)
+    local noise_ores = Public.get_noise('no_rocks_2', p, seed + 25000)
 
     if cave_rivers_3 > -0.20 and cave_rivers_3 < 0.20 then
         tiles[#tiles + 1] = {name = 'grass-' .. floor(cave_rivers_3 * 32) % 3 + 1, position = p}
@@ -1342,8 +1338,8 @@ local function zone_7(x, y, data, void_or_lab, adjusted_zones)
     end
 
     --Chasms
-    local noise_cave_ponds = get_perlin('cave_ponds', p, seed)
-    local small_caves = get_perlin('small_caves', p, seed)
+    local noise_cave_ponds = Public.get_noise('cave_ponds', p, seed)
+    local small_caves = Public.get_noise('small_caves', p, seed)
     if noise_cave_ponds < 0.25 and noise_cave_ponds > -0.25 then
         if small_caves > 0.55 then
             tiles[#tiles + 1] = {name = void_or_lab, position = p}
@@ -1360,7 +1356,7 @@ local function zone_7(x, y, data, void_or_lab, adjusted_zones)
     --Resource Spots
     if smol_areas < -0.72 then
         if random(1, 32) == 1 then
-            Generate_resources(buildings, p, zone_settings.zone_depth)
+            Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
         end
     end
 
@@ -1383,13 +1379,13 @@ local function zone_forest_2(x, y, data, void_or_lab, adjusted_zones)
     local treasure = data.treasure
     data.forest_zone = true
 
-    local large_caves = get_perlin('large_caves', p, seed)
-    local cave_rivers = get_perlin('cave_rivers', p, seed)
-    local smol_areas = get_perlin('smol_areas', p, seed + 25000)
+    local large_caves = Public.get_noise('large_caves', p, seed)
+    local cave_rivers = Public.get_noise('cave_rivers', p, seed)
+    local smol_areas = Public.get_noise('smol_areas', p, seed + 25000)
 
     --Chasms
-    local noise_cave_ponds = get_perlin('cave_ponds', p, seed)
-    local small_caves = get_perlin('small_caves', p, seed)
+    local noise_cave_ponds = Public.get_noise('cave_ponds', p, seed)
+    local small_caves = Public.get_noise('small_caves', p, seed)
     if noise_cave_ponds < 0.45 and noise_cave_ponds > -0.45 then
         if small_caves > 0.45 then
             tiles[#tiles + 1] = {name = void_or_lab, position = p}
@@ -1414,7 +1410,7 @@ local function zone_forest_2(x, y, data, void_or_lab, adjusted_zones)
     if smol_areas < 0.055 and smol_areas > -0.025 then
         tiles[#tiles + 1] = {name = 'deepwater-green', position = p}
         if random(1, 32) == 1 then
-            Generate_resources(buildings, p, zone_settings.zone_depth)
+            Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
         end
         if random(1, 128) == 1 then
             Biters.wave_defense_set_worm_raffle(abs(p.y) * worm_level_modifier)
@@ -1428,7 +1424,7 @@ local function zone_forest_2(x, y, data, void_or_lab, adjusted_zones)
 
         return
     end
-    local noise_forest_location = get_perlin('forest_location', p, seed)
+    local noise_forest_location = Public.get_noise('forest_location', p, seed)
     if cave_rivers > -0.1 and cave_rivers < 0.1 then
         local success = place_wagon(data, adjusted_zones)
         if success then
@@ -1517,9 +1513,9 @@ local function zone_5(x, y, data, void_or_lab, adjusted_zones)
     local buildings = data.buildings
     local treasure = data.treasure
 
-    local small_caves = get_perlin('small_caves', p, seed)
-    local noise_cave_ponds = get_perlin('cave_ponds', p, seed)
-    local smol_areas = get_perlin('smol_areas', p, seed + 20000)
+    local small_caves = Public.get_noise('small_caves', p, seed)
+    local noise_cave_ponds = Public.get_noise('cave_ponds', p, seed)
+    local smol_areas = Public.get_noise('smol_areas', p, seed + 20000)
 
     if small_caves > -0.24 and small_caves < 0.24 then
         tiles[#tiles + 1] = {name = 'dirt-7', position = p}
@@ -1556,7 +1552,7 @@ local function zone_5(x, y, data, void_or_lab, adjusted_zones)
     if smol_areas < 0.055 and smol_areas > -0.025 then
         tiles[#tiles + 1] = {name = 'deepwater-green', position = p}
         if random(1, 32) == 1 then
-            Generate_resources(buildings, p, zone_settings.zone_depth)
+            Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
         end
         if random(1, 128) == 1 then
             Biters.wave_defense_set_worm_raffle(abs(p.y) * worm_level_modifier)
@@ -1610,10 +1606,10 @@ local function zone_4(x, y, data, void_or_lab, adjusted_zones)
     local markets = data.markets
     local treasure = data.treasure
 
-    local noise_large_caves = get_perlin('large_caves', p, seed)
-    local noise_cave_ponds = get_perlin('cave_ponds', p, seed)
-    local small_caves = get_perlin('dungeons', p, seed)
-    local smol_areas = get_perlin('smol_areas', p, seed + 15000)
+    local noise_large_caves = Public.get_noise('large_caves', p, seed)
+    local noise_cave_ponds = Public.get_noise('cave_ponds', p, seed)
+    local small_caves = Public.get_noise('dungeons', p, seed)
+    local smol_areas = Public.get_noise('smol_areas', p, seed + 15000)
 
     if abs(noise_large_caves) > 0.7 then
         tiles[#tiles + 1] = {name = 'water', position = p}
@@ -1692,7 +1688,7 @@ local function zone_4(x, y, data, void_or_lab, adjusted_zones)
     if smol_areas < 0.055 and smol_areas > -0.025 then
         tiles[#tiles + 1] = {name = 'deepwater-green', position = p}
         if random(1, 32) == 1 then
-            Generate_resources(buildings, p, zone_settings.zone_depth)
+            Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
         end
         if random(1, 128) == 1 then
             Biters.wave_defense_set_worm_raffle(abs(p.y) * worm_level_modifier)
@@ -1709,7 +1705,7 @@ local function zone_4(x, y, data, void_or_lab, adjusted_zones)
 
     if noise_large_caves > -0.2 and noise_large_caves < 0.2 then
         --Main Rock Terrain
-        local no_rocks_2 = get_perlin('no_rocks_2', p, seed + 75000)
+        local no_rocks_2 = Public.get_noise('no_rocks_2', p, seed + 75000)
         if no_rocks_2 > 0.80 or no_rocks_2 < -0.80 then
             tiles[#tiles + 1] = {name = 'dirt-' .. floor(no_rocks_2 * 8) % 2 + 5, position = p}
             if random(1, 512) == 1 then
@@ -1741,18 +1737,18 @@ local function zone_3(x, y, data, void_or_lab, adjusted_zones)
     local markets = data.markets
     local treasure = data.treasure
 
-    local small_caves = get_perlin('dungeons', p, seed + 50000)
-    local small_caves_2 = get_perlin('small_caves_2', p, seed + 70000)
-    local noise_large_caves = get_perlin('large_caves', p, seed + 60000)
-    local noise_cave_ponds = get_perlin('cave_ponds', p, seed)
-    local cave_miner = get_perlin('cave_miner_01', p, seed)
-    local smol_areas = get_perlin('smol_areas', p, seed + 60000)
+    local small_caves = Public.get_noise('dungeons', p, seed + 50000)
+    local small_caves_2 = Public.get_noise('small_caves_2', p, seed + 70000)
+    local noise_large_caves = Public.get_noise('large_caves', p, seed + 60000)
+    local noise_cave_ponds = Public.get_noise('cave_ponds', p, seed)
+    local cave_miner = Public.get_noise('cave_miner_01', p, seed)
+    local smol_areas = Public.get_noise('smol_areas', p, seed + 60000)
 
     --Resource Spots
     if smol_areas < 0.055 and smol_areas > -0.025 then
         tiles[#tiles + 1] = {name = 'deepwater-green', position = p}
         if random(1, 32) == 1 then
-            Generate_resources(buildings, p, zone_settings.zone_depth)
+            Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
         end
         if random(1, 128) == 1 then
             Biters.wave_defense_set_worm_raffle(abs(p.y) * worm_level_modifier)
@@ -1809,7 +1805,7 @@ local function zone_3(x, y, data, void_or_lab, adjusted_zones)
         end
 
         --Rivers
-        local cave_rivers = get_perlin('cave_rivers', p, seed + 100000)
+        local cave_rivers = Public.get_noise('cave_rivers', p, seed + 100000)
         if cave_rivers < 0.024 and cave_rivers > -0.024 then
             if noise_cave_ponds > 0.2 then
                 tiles[#tiles + 1] = {name = 'water-shallow', position = p}
@@ -1819,7 +1815,7 @@ local function zone_3(x, y, data, void_or_lab, adjusted_zones)
                 return
             end
         end
-        local cave_rivers_2 = get_perlin('cave_rivers_2', p, seed)
+        local cave_rivers_2 = Public.get_noise('cave_rivers_2', p, seed)
         if cave_rivers_2 < 0.024 and cave_rivers_2 > -0.024 then
             if noise_cave_ponds < 0.4 then
                 tiles[#tiles + 1] = {name = 'water-shallow', position = p}
@@ -1835,7 +1831,7 @@ local function zone_3(x, y, data, void_or_lab, adjusted_zones)
             return
         end
 
-        local no_rocks = get_perlin('no_rocks', p, seed + 25000)
+        local no_rocks = Public.get_noise('no_rocks', p, seed + 25000)
         --Worm oil Zones
         if no_rocks < 0.20 and no_rocks > -0.20 then
             if small_caves > 0.35 then
@@ -1867,7 +1863,7 @@ local function zone_3(x, y, data, void_or_lab, adjusted_zones)
         end
 
         --Main Rock Terrain
-        local no_rocks_2 = get_perlin('no_rocks_2', p, seed + 75000)
+        local no_rocks_2 = Public.get_noise('no_rocks_2', p, seed + 75000)
         if no_rocks_2 > 0.80 or no_rocks_2 < -0.80 then
             local success = place_wagon(data, adjusted_zones)
             if success then
@@ -1907,15 +1903,15 @@ local function zone_2(x, y, data, void_or_lab, adjusted_zones)
     local markets = data.markets
     local treasure = data.treasure
 
-    local small_caves = get_perlin('dungeons', p, seed)
-    local noise_large_caves = get_perlin('large_caves', p, seed)
-    local smol_areas = get_perlin('smol_areas', p, seed + 15000)
+    local small_caves = Public.get_noise('dungeons', p, seed)
+    local noise_large_caves = Public.get_noise('large_caves', p, seed)
+    local smol_areas = Public.get_noise('smol_areas', p, seed + 15000)
 
     --Resource Spots
     if smol_areas < 0.055 and smol_areas > -0.025 then
         tiles[#tiles + 1] = {name = 'deepwater-green', position = p}
         if random(1, 32) == 1 then
-            Generate_resources(buildings, p, zone_settings.zone_depth)
+            Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
         end
         if random(1, 128) == 1 then
             Biters.wave_defense_set_worm_raffle(abs(p.y) * worm_level_modifier)
@@ -1930,7 +1926,7 @@ local function zone_2(x, y, data, void_or_lab, adjusted_zones)
     end
 
     if noise_large_caves > -0.75 and noise_large_caves < 0.75 then
-        local noise_cave_ponds = get_perlin('cave_ponds', p, seed)
+        local noise_cave_ponds = Public.get_noise('cave_ponds', p, seed)
 
         --Chasms
         if noise_cave_ponds < 0.15 and noise_cave_ponds > -0.15 then
@@ -1955,7 +1951,7 @@ local function zone_2(x, y, data, void_or_lab, adjusted_zones)
         end
 
         --Rivers
-        local cave_rivers = get_perlin('cave_rivers', p, seed + 100000)
+        local cave_rivers = Public.get_noise('cave_rivers', p, seed + 100000)
         if cave_rivers < 0.037 and cave_rivers > -0.037 then
             if noise_cave_ponds < 0.1 then
                 tiles[#tiles + 1] = {name = 'water-shallow', position = p}
@@ -1983,7 +1979,7 @@ local function zone_2(x, y, data, void_or_lab, adjusted_zones)
             return
         end
 
-        local no_rocks = get_perlin('no_rocks', p, seed + 25000)
+        local no_rocks = Public.get_noise('no_rocks', p, seed + 25000)
         --Worm oil Zones
         if no_rocks < 0.20 and no_rocks > -0.20 then
             if small_caves > 0.30 then
@@ -2015,7 +2011,7 @@ local function zone_2(x, y, data, void_or_lab, adjusted_zones)
         end
 
         --Main Rock Terrain
-        local no_rocks_2 = get_perlin('no_rocks_2', p, seed + 75000)
+        local no_rocks_2 = Public.get_noise('no_rocks_2', p, seed + 75000)
         if no_rocks_2 > 0.80 or no_rocks_2 < -0.80 then
             local success = place_wagon(data, adjusted_zones)
             if success then
@@ -2052,15 +2048,15 @@ local function zone_forest_1(x, y, data, void_or_lab, adjusted_zones)
     local treasure = data.treasure
     data.forest_zone = true
 
-    local small_caves = get_perlin('dungeons', p, seed + 33322)
-    local noise_cave_ponds = get_perlin('cave_ponds', p, seed)
-    local smol_areas = get_perlin('smol_areas', p, seed + 33333)
+    local small_caves = Public.get_noise('dungeons', p, seed + 33322)
+    local noise_cave_ponds = Public.get_noise('cave_ponds', p, seed)
+    local smol_areas = Public.get_noise('smol_areas', p, seed + 33333)
 
     --Resource Spots
     if smol_areas < 0.055 and smol_areas > -0.025 then
         tiles[#tiles + 1] = {name = 'deepwater-green', position = p}
         if random(1, 32) == 1 then
-            Generate_resources(buildings, p, zone_settings.zone_depth)
+            Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
         end
         if random(1, 128) == 1 then
             Biters.wave_defense_set_worm_raffle(abs(p.y) * worm_level_modifier)
@@ -2106,7 +2102,7 @@ local function zone_forest_1(x, y, data, void_or_lab, adjusted_zones)
     end
 
     --Rivers
-    local cave_rivers = get_perlin('cave_rivers', p, seed + 200000)
+    local cave_rivers = Public.get_noise('cave_rivers', p, seed + 200000)
     if cave_rivers < 0.041 and cave_rivers > -0.042 then
         if noise_cave_ponds > 0 then
             tiles[#tiles + 1] = {name = 'water-shallow', position = p}
@@ -2128,7 +2124,7 @@ local function zone_forest_1(x, y, data, void_or_lab, adjusted_zones)
         return
     end
 
-    local no_rocks = get_perlin('no_rocks', p, seed + 30000)
+    local no_rocks = Public.get_noise('no_rocks', p, seed + 30000)
     --Worm oil Zones
     if p.y < -64 + noise_cave_ponds * 10 then
         if no_rocks < 0.11 and no_rocks > -0.11 then
@@ -2159,7 +2155,7 @@ local function zone_forest_1(x, y, data, void_or_lab, adjusted_zones)
     end
 
     --Main Rock Terrain
-    local no_rocks_2 = get_perlin('no_rocks_2', p, seed + 5000)
+    local no_rocks_2 = Public.get_noise('no_rocks_2', p, seed + 5000)
     if no_rocks_2 > 0.64 or no_rocks_2 < -0.64 then
         local success = place_wagon(data, adjusted_zones)
         if success then
@@ -2180,7 +2176,7 @@ local function zone_forest_1(x, y, data, void_or_lab, adjusted_zones)
         treasure[#treasure + 1] = {position = p, chest = 'iron-chest'}
     end
     tiles[#tiles + 1] = {name = 'landfill', position = p}
-    local noise_forest_location = get_perlin('forest_location', p, seed)
+    local noise_forest_location = Public.get_noise('forest_location', p, seed)
     if noise_forest_location > 0.095 then
         if random(1, 256) == 1 then
             Biters.wave_defense_set_worm_raffle(abs(p.y) * worm_level_modifier)
@@ -2235,14 +2231,14 @@ local function zone_1(x, y, data, void_or_lab, adjusted_zones)
     local markets = data.markets
     local treasure = data.treasure
 
-    local small_caves = get_perlin('dungeons', p, seed)
-    local noise_cave_ponds = get_perlin('cave_ponds', p, seed)
-    local smol_areas = get_perlin('smol_areas', p, seed)
+    local small_caves = Public.get_noise('dungeons', p, seed)
+    local noise_cave_ponds = Public.get_noise('cave_ponds', p, seed)
+    local smol_areas = Public.get_noise('smol_areas', p, seed)
 
     if smol_areas < 0.055 and smol_areas > -0.025 then
         tiles[#tiles + 1] = {name = 'deepwater-green', position = p}
         if random(1, 32) == 1 then
-            Generate_resources(buildings, p, zone_settings.zone_depth)
+            Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
         end
         if random(1, 32) == 1 then
             Biters.wave_defense_set_worm_raffle(abs(p.y) * worm_level_modifier)
@@ -2288,7 +2284,7 @@ local function zone_1(x, y, data, void_or_lab, adjusted_zones)
     end
 
     --Rivers
-    local cave_rivers = get_perlin('cave_rivers', p, seed + 300000)
+    local cave_rivers = Public.get_noise('cave_rivers', p, seed + 300000)
     if cave_rivers < 0.042 and cave_rivers > -0.042 then
         if noise_cave_ponds > 0 then
             tiles[#tiles + 1] = {name = 'water-shallow', position = p}
@@ -2310,7 +2306,7 @@ local function zone_1(x, y, data, void_or_lab, adjusted_zones)
         return
     end
 
-    local no_rocks = get_perlin('no_rocks', p, seed + 50000)
+    local no_rocks = Public.get_noise('no_rocks', p, seed + 50000)
     --Worm oil Zones
     if p.y < -64 + noise_cave_ponds * 10 then
         if no_rocks < 0.12 and no_rocks > -0.12 then
@@ -2341,7 +2337,7 @@ local function zone_1(x, y, data, void_or_lab, adjusted_zones)
     end
 
     --Main Rock Terrain
-    local no_rocks_2 = get_perlin('no_rocks_2', p, seed + 75000)
+    local no_rocks_2 = Public.get_noise('no_rocks_2', p, seed + 75000)
     if no_rocks_2 > 0.66 or no_rocks_2 < -0.66 then
         local success = place_wagon(data, adjusted_zones)
         if success then
@@ -2361,7 +2357,7 @@ local function zone_1(x, y, data, void_or_lab, adjusted_zones)
     if random(1, 2048) == 1 then
         treasure[#treasure + 1] = {position = p, chest = 'iron-chest'}
     end
-    local random_tiles = get_perlin('forest_location', p, seed)
+    local random_tiles = Public.get_noise('forest_location', p, seed)
     if random_tiles > 0.095 then
         if random_tiles > 0.6 then
             if random(1, 100) > 42 then
@@ -2399,17 +2395,17 @@ local function starting_zone(x, y, data, void_or_lab, adjusted_zones)
     local markets = data.markets
     local treasure = data.treasure
 
-    local small_caves = get_perlin('dungeons', p, seed + 34883)
-    local noise_cave_ponds = get_perlin('cave_ponds', p, seed + 28939)
-    local smol_areas = get_perlin('smol_areas', p, seed + 3992)
-    local no_rocks_2 = get_perlin('no_rocks_2', p, seed + 1922)
-    local cave_rivers = get_perlin('cave_rivers', p, seed)
-    local no_rocks = get_perlin('no_rocks', p, seed)
+    local small_caves = Public.get_noise('dungeons', p, seed + 34883)
+    local noise_cave_ponds = Public.get_noise('cave_ponds', p, seed + 28939)
+    local smol_areas = Public.get_noise('smol_areas', p, seed + 3992)
+    local no_rocks_2 = Public.get_noise('no_rocks_2', p, seed + 1922)
+    local cave_rivers = Public.get_noise('cave_rivers', p, seed)
+    local no_rocks = Public.get_noise('no_rocks', p, seed)
 
     if smol_areas < 0.055 and smol_areas > -0.025 then
         entities[#entities + 1] = {name = rock_raffle[random(1, size_of_rock_raffle)], position = p}
         if random(1, 32) == 1 then
-            Generate_resources(buildings, p, zone_settings.zone_depth)
+            Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
         end
         if random(1, 128) == 1 then
             Biters.wave_defense_set_worm_raffle(abs(p.y) * worm_level_modifier)
@@ -2625,7 +2621,7 @@ local function process_bits(p, data, adjusted_zones)
         adjusted_zones.scrap[index] = true
     end
 
-    local void_or_tile = WPT.get('void_or_tile')
+    local void_or_tile = Public.get('void_or_tile')
 
     local x = p.x
     local y = p.y
@@ -2644,7 +2640,7 @@ local function border_chunk(p, data)
         entities[#entities + 1] = {name = trees[random(1, #trees)], position = pos}
     end
 
-    local noise = get_perlin('dungeons', pos, data.seed)
+    local noise = Public.get_noise('dungeons', pos, data.seed)
     local index = floor(noise * 32) % 4 + 1
     tiles[#tiles + 1] = {name = start_ground_tiles[index], position = pos}
 
@@ -2680,10 +2676,10 @@ local function biter_chunk(p, data)
     tile_positions[#tile_positions + 1] = p
 
     local disable_spawners = {
-        callback = Functions.deactivate_callback
+        callback = Public.deactivate_callback
     }
     local disable_worms = {
-        callback = Functions.active_not_destructible_callback
+        callback = Public.active_not_destructible_callback
     }
 
     if random(1, 128) == 1 then
@@ -2722,7 +2718,7 @@ function Public.heavy_functions(data)
     local p = data.position
     local get_tile = surface.get_tile(p)
 
-    local adjusted_zones = WPT.get('adjusted_zones')
+    local adjusted_zones = Public.get('adjusted_zones')
     init_terrain(adjusted_zones)
 
     local map_name = 'mtn_v3'
@@ -2740,7 +2736,7 @@ function Public.heavy_functions(data)
     end
 
     if top_y % zone_settings.zone_depth == 0 and top_y < 0 then
-        WPT.set('left_top', data.left_top)
+        Public.set('left_top', data.left_top)
         return wall(p, data)
     end
 
@@ -2780,7 +2776,7 @@ Event.add(
             return
         end
 
-        local winter_mode = WPT.get('winter_mode')
+        local winter_mode = Public.get('winter_mode')
         if winter_mode then
             rendering.draw_sprite(
                 {
@@ -2796,7 +2792,7 @@ Event.add(
         end
 
         if left_top.y == -128 and left_top.x == -128 then
-            local locomotive = WPT.get('locomotive')
+            local locomotive = Public.get('locomotive')
             if locomotive and locomotive.valid then
                 local position = locomotive.position
                 for _, entity in pairs(surface.find_entities_filtered({area = {{position.x - 5, position.y - 6}, {position.x + 5, position.y + 10}}, type = 'simple-entity'})) do
diff --git a/maps/mountain_fortress_v3/traps.lua b/maps/mountain_fortress_v3/traps.lua
index ceb5baf1..1a2dd559 100644
--- a/maps/mountain_fortress_v3/traps.lua
+++ b/maps/mountain_fortress_v3/traps.lua
@@ -1,5 +1,5 @@
 local Event = require 'utils.event'
-local WPT = require 'maps.mountain_fortress_v3.table'
+local Public = require 'maps.mountain_fortress_v3.table'
 
 local random = math.random
 
@@ -85,7 +85,7 @@ local function create_kaboom(surface, position, name)
     )
 end
 
-local function tick_tack_trap(surface, position)
+function Public.tick_tack_trap(surface, position)
     if not surface then
         return
     end
@@ -101,7 +101,7 @@ local function tick_tack_trap(surface, position)
     if not position.y then
         return
     end
-    local traps = WPT.get('traps')
+    local traps = Public.get('traps')
     local tick_tack_count = random(5, 9)
     for t = 60, tick_tack_count * 60, 60 do
         if not traps[game.tick + t] then
@@ -130,7 +130,7 @@ local function tick_tack_trap(surface, position)
 end
 
 local function on_tick()
-    local traps = WPT.get('traps')
+    local traps = Public.get('traps')
     if not traps[game.tick] then
         return
     end
@@ -148,4 +148,4 @@ end
 
 Event.add(defines.events.on_tick, on_tick)
 
-return tick_tack_trap
+return Public
diff --git a/modules/render_beam.lua b/modules/render_beam.lua
index 7ce18c21..3fccfb22 100644
--- a/modules/render_beam.lua
+++ b/modules/render_beam.lua
@@ -45,10 +45,11 @@ local remove = table.remove
 local speed = 0.06
 
 --- Draws a new render.
----@return integer
+---@return table
 function Public:new_render()
     local surface = game.get_surface(self.surface_id)
     self.render_id = rendering.draw_sprite {target = self.position, sprite = self.sprite, surface = surface}
+    return self
 end
 
 --- Sets a new target for a given render.
diff --git a/utils/antigrief.lua b/utils/antigrief.lua
index 56692c8c..bdd7d2d8 100644
--- a/utils/antigrief.lua
+++ b/utils/antigrief.lua
@@ -1164,7 +1164,7 @@ function Public.damage_entity_threshold(value)
 end
 
 --- Returns the table.
----@param key string
+---@param key string|nil
 function Public.get(key)
     if key then
         return this[key]
diff --git a/utils/gui.lua b/utils/gui.lua
index 4543c4d5..fb351545 100644
--- a/utils/gui.lua
+++ b/utils/gui.lua
@@ -654,6 +654,10 @@ function Public.call_existing_tab(player, name)
     if not frame then
         return
     end
+    if not inside_frame then
+        return
+    end
+
     local tabbed_pane = inside_frame.tabbed_pane
     for key, v in pairs(tabbed_pane.tabs) do
         if v.tab.caption == name then
diff --git a/utils/gui/bottom_frame.lua b/utils/gui/bottom_frame.lua
index c072cba3..86985b92 100644
--- a/utils/gui/bottom_frame.lua
+++ b/utils/gui/bottom_frame.lua
@@ -19,7 +19,10 @@ Global.register(
 
 local Public = {}
 
-Public.events = {bottom_quickbar_button_name = Event.generate_event_name('bottom_quickbar_button_name')}
+Public.events = {
+    bottom_quickbar_button_name = Event.generate_event_name('bottom_quickbar_button_name'),
+    bottom_quickbar_respawn_raise = Event.generate_event_name('bottom_quickbar_respawn_raise')
+}
 
 local main_frame_name = Gui.uid_name()
 local clear_corpse_button_name = Gui.uid_name()
@@ -325,4 +328,19 @@ Public.main_frame_name = main_frame_name
 Public.set_location = set_location
 Gui.screen_to_bypass(main_frame_name)
 
+Event.add(
+    Public.events.bottom_quickbar_respawn_raise,
+    function(event)
+        if not event or not event.player_index then
+            return
+        end
+
+        if this.activate_custom_buttons then
+            local player = game.get_player(event.player_index)
+            local data = Public.get_player_data(player)
+            set_location(player, data.state)
+        end
+    end
+)
+
 return Public