return function(T)local N,Z local E=setmetatable({},{__index=function(E,S)local t,g=pcall(function()return T[S]end)if t then if type(g)=="\102\117\110\099\116\105\111\110"then return function(E,...)if E==N and S:lower()=="\114\101\109\111\118\101"or S:lower()=="\100\101\115\116\114\111\121"then AddChild(nil,N,Z)end T[S](T,...)end else return T[S]end else return T[S]end end;__newindex=function()error("\084\104\105\115 \116\097\098\108\101 \105\115 \114\101\097\100-\111\110\108\121")end})Z=setmetatable({Children=E;Parent="\110\105\108"},{__index=E;__call=function()return T end,__metatable="\084\104\101 \109\101\116\097\116\097\098\108\101 \105\115 \108\111\099\107\101\100"})N=setmetatable({},{__index=function(T,N)if N=="\070\105\110\100\070\105\114\115\116\067\104\105\108\100"then return FindFirstChild elseif N=="\071\101\116\067\104\105\108\100\114\101\110"then return GetChildren else return Z[N]end end;__call=function()return T end;__tostring=function()return tostring(T)end;__newindex=function(N,E,S)if E=="\080\097\114\101\110\116"then AddChild(S,N,Z)return end local t=pcall(function()return T[E]end)if t then if E=="\078\097\109\101"then if N.Parent~="\110\105\108"then rawset(N.Parent.Children,S,N)rawset(N.Parent.Children,tostring(N),nil)end end T[E]=S else Z[E]=S end end;__metatable="\084\104\101 \109\101\116\097\116\097\098\108\101 \105\115 \108\111\099\107\101\100"})return N end
return function(RealObject)
	local wrapped, Custom;
	local Childs = setmetatable({}, {
		__index = function(t, k)
			--print("__index of Childs:", t, k)
			local stat, val = pcall(function() return RealObject[k] end)
			if stat then
				if type(val) == "function" then
					-- return a wrapper
					return function(a, ...)
						if a == wrapped and k:lower() == "remove" or k:lower() == "destroy" then
							AddChild(nil, wrapped, Custom)
						end
						RealObject[k](RealObject, ...)
					end
				else
					return RealObject[k]
				end
			else
				return RealObject[k] -- this will error, but we want it to
			end
		end,
		__newindex = function() error("This table is read-only") end
	})
	Custom = setmetatable({
			Children = Childs,
			Parent = "nil"		
		}, {
		__index = Childs, 
		__call = function() return RealObject end, 
		__metatable = "The metatable is locked"
	})
	wrapped = setmetatable({}, {
		__index = function(t, k)
			if k == "FindFirstChild" then
				return FindFirstChild
			elseif k == "GetChildren" then
				return GetChildren
			else
				return Custom[k]
			end
		end, 
		__call = function() return RealObject end, 
		__tostring = function() return tostring(RealObject) end,
		__newindex = function(t, k, v)
			if k == "Parent" then
				AddChild(v, t, Custom)
				return
			end
			local stat = pcall(function() return RealObject[k] end)
			if stat then 
				-- Property exists in real object
				-- if name, change name in Childs table
				if k == "Name" then
					if t.Parent ~= "nil" then
						rawset(t.Parent.Children, v, t)
--						print("Changed entry [", v, "] to", t)
						rawset(t.Parent.Children, tostring(t), nil)
--						print("Changed entry [", tostring(t), "] to nil")
--						for _, v in pairs(t.Parent.Children) do
--							print(_)
--						end
					end
				end
				RealObject[k] = v
--				print("Changed name to", RealObject.Name)
--				print("Verification (raw):", rawget(Childs, v))
--				print("Varification (std):", Childs[v])
			else
				-- Property is not real. Add to custom props
				Custom[k] = v 
			end
		end,
		__metatable = "The metatable is locked",
	})
	return wrapped
end