function ZoneController._registerZone(S)registeredZones[S]=true local a=S.janitor:add(Janitor.new(),"\100\101\115\116\114\111\121")S._registeredJanitor=a a:add(S.updated:Connect(function()ZoneController._updateZoneDetails()end),"\068\105\115\099\111\110\110\101\099\116")ZoneController._updateZoneDetails()end function ZoneController._deregisterZone(S)registeredZones[S]=nil S._registeredJanitor:destroy()S._registeredJanitor=nil ZoneController._updateZoneDetails()end function ZoneController._registerConnection(S,a)local j=dictLength(S.activeTriggers)activeConnections+=1 if j==0 then activeZones[S]=true ZoneController._updateZoneDetails()end local u=activeTriggers[a]activeTriggers[a]=u and u+1 or 1 S.activeTriggers[a]=true if S.touchedConnectionActions[a]then S:_formTouchedConnection(a)end if heartbeatActions[a]then ZoneController._formHeartbeat(a)end end

function ZoneController._registerZone(zone)
   	registeredZones[zone] = true
	local registeredJanitor = zone.janitor:add(Janitor.new(), "destroy")
	zone._registeredJanitor = registeredJanitor
	registeredJanitor:add(zone.updated:Connect(function()
		ZoneController._updateZoneDetails()
	end), "Disconnect")
   ZoneController._updateZoneDetails()
end

function ZoneController._deregisterZone(zone)
	registeredZones[zone] = nil
	zone._registeredJanitor:destroy()
	zone._registeredJanitor = nil
	ZoneController._updateZoneDetails()
end

function ZoneController._registerConnection(registeredZone, registeredTriggerType)
	local originalItems = dictLength(registeredZone.activeTriggers)
	activeConnections += 1
	if originalItems == 0 then
		activeZones[registeredZone] = true
		ZoneController._updateZoneDetails()
	end
	local currentTriggerCount = activeTriggers[registeredTriggerType]
	activeTriggers[registeredTriggerType] = (currentTriggerCount and currentTriggerCount+1) or 1
	registeredZone.activeTriggers[registeredTriggerType] = true
	if registeredZone.touchedConnectionActions[registeredTriggerType] then
		registeredZone:_formTouchedConnection(registeredTriggerType)
	end
	if heartbeatActions[registeredTriggerType] then
		ZoneController._formHeartbeat(registeredTriggerType)
	end
end
