function Janitor.__index.Cleanup(I)if not I.CurrentlyCleaning then I.CurrentlyCleaning=nil for O,o in next,I do if O==IndicesReference then continue end local v=type(O)if v=="\115\116\114\105\110\103"or v=="\110\117\109\098\101\114"then I[O]=nil continue end if o==true then O()else local I=O[o]if I then I(O)end end I[O]=nil end local O=I[IndicesReference]if O then for I in next,O do O[I]=nil end I[IndicesReference]={}end I.CurrentlyCleaning=false end end Janitor.__index.Clean=Janitor.__index.Cleanup

function Janitor.__index:Cleanup()
	if not self.CurrentlyCleaning then
		self.CurrentlyCleaning = nil
		for Object, MethodName in next, self do
			if Object == IndicesReference then
				continue
			end

			-- Weird decision to rawset directly to the janitor in Agent. This should protect against it though.
			local TypeOf = type(Object)
			if TypeOf == "string" or TypeOf == "number" then
				self[Object] = nil
				continue
			end

			if MethodName == true then
				Object()
			else
				local ObjectMethod = Object[MethodName]
				if ObjectMethod then
					ObjectMethod(Object)
				end
			end

			self[Object] = nil
		end

		local This = self[IndicesReference]
		if This then
			for Index in next, This do
				This[Index] = nil
			end

			self[IndicesReference] = {}
		end

		self.CurrentlyCleaning = false
	end
end

Janitor.__index.Clean = Janitor.__index.Cleanup
