function ghi_saveddata(table)
	local class = Class("ghi_saveddata")
	local GTable = table

	-- Class functions
	class.addVal = function (self, val, ...)
		local addPar = {...}
		
		if GTable == nil then
			GTable = {}
		end
		
		local iter = 1
		local curr = GTable
		
		-- Every addPar except the last one
		while iter < #addPar do
			-- If nil has been given as argument
			if addPar[iter] == nil then
				error("ghi_saveddata.addVal called with a nil index")
				return
			end
		
			-- If GTable has not been initialized this far 
			if curr[addPar[iter]] == nil then
				curr[addPar[iter]] = {}
			end
			
			-- Move towards the target table
			curr = curr[addPar[iter]]
			iter = iter + 1
		end
		
		-- in case #addPar was 0
		if iter == #addPar then
			curr[addPar[iter]] = val
		else
			error("ghi_saveddata.addVal called with no indices")
			return
		end
	end

	class.getVal = function (self, ...)
		local getPar = {...}
		
		if GTable == nil then
			GTable = {}
		end
		
		local iter = 1
		local curr = GTable
		-- Every getPar except for the last one
		while iter < #getPar do
			-- If nil has been given as argument
			if addPar[iter] == nil then
				error("ghi_saveddata.getVal called with a nil index")
				return
			end
			
			-- If GTable has not been initialized this far
			if curr[getPar[iter]] == nil then
				curr[getPar[iter]] = {}
			end
			
			-- Move towards the target table
			curr = curr[getPar[iter]]
			iter = iter +1
		end
		
		--in case #getPar was 0
		if iter == #getPar do
			-- In case it wasn't initialized yet
			if curr[getPar[iter]] == nil do
				curr[getPar[iter]] = 0
			end
			return curr[getPar[iter]]
		else
			error("ghi_saveddata.getVal called with no indices")
			return
		end
	end
	
	return class
end
