local function sortArray(array)
	local lastMax = 1000
	local maxv, maxk = 0, 0
	local temparray = {}
	for k, v in ipairs(array) do
		temparray[k] = v
	end
	local sorted = {}
	for k, v in ipairs(array) do
		maxv, maxk = 0, 0
		for k2, v2 in ipairs(temparray) do
			if lastMax and v2 > maxv and v2 <= lastMax then
				maxv = v2
				maxk = k2
			end
		end
		sorted[k] = maxv
		table.remove(temparray, maxk)
		lastMax = maxv
	end
	return sorted
end
