function osprogram.program()
	local color = {
		["0"] = colors.white,
		["1"] = colors.orange,
		["2"] = colors.magenta,
		["3"] = colors.lightBlue,
		["4"] = colors.yellow,
		["5"] = colors.lime,
		["6"] = colors.pink,
		["7"] = colors.gray,
		["8"] = colors.lightGray,
		["9"] = colors.cyan,
		["a"] = colors.purple,
		["b"] = colors.blue,
		["c"] = colors.brown,
		["d"] = colors.green,
		["e"] = colors.red,
		["f"] = colors.black,
		[" "] = userColor.back
	}
	
	local colorMenu = {
		["0"] = colors.white,
		["1"] = colors.orange,
		["2"] = colors.magenta,
		["3"] = colors.lightBlue,
		["4"] = colors.yellow,
		["5"] = colors.lime,
		["6"] = colors.pink,
		["7"] = colors.gray,
		["8"] = colors.lightGray,
		["9"] = colors.cyan,
		["a"] = colors.purple,
		["b"] = colors.blue,
		["c"] = colors.brown,
		["d"] = colors.green,
		["e"] = colors.red,
		["f"] = colors.black,
		[" "] = userColor.noFocus
	}
	
	local desktopProgs = {}
	local desktopFile = io.open("desktop", "r")
	local desktopProg = desktopFile:read()
	
	while desktopProg do
		desktopProgs[#desktopProgs + 1] = desktopProg
		desktopProg = desktopFile:read()
	end
	
	desktopFile:close()
	
	local function isDesk(name)
		for i = 1,#desktopProgs do
			if desktopProgs[i] == name then
				return true
			end
		end
	end
	
	local tab = 1
	local tabs = 1
	local menu = false
	local menuProg
	local progs = {}
	local _n = 0
	
	local function reloadList()
		tab = 1
		tabs = 1
		menu = false
		progs = {}
		_n = 0
		
		for k,name in ipairs(fs.list("programs")) do
			if not isDesk(name) then 
				_n = _n + 1
					
				if _n > 18 then
					_n = 0
					tabs = tabs + 1
				end
				
				progs[name] = {}
				
				local file = io.open("programs/" .. name .. "/icon")
				progs[name].iconColor = file:read()
				progs[name].iconTextColor = file:read()
				progs[name].iconText = file:read()
				file:close()
			end
		end
	end
	
	reloadList()
	
	while true do
		local event, b, mx, my = os.pullEvent()
		
		local x, y = 3, 2
		local w, h = window.getSize()
		local n = 0
		local t = 1
	
		for name in pairs(progs) do
			n = n + 1
			
			if n > 18 then
				n = 0
				t = t + 1
			end
			
			if t == tab and not menu then
			
				if event == "mouse_click" then
					if mx >= x + 2 and mx <= x + 5 and my >= y + 1 and my <= y + 3 then
						if b == 1 then
							osState = 5
							osNext = name
							return
						elseif b == 2 then
							menu = true
							menuProg = name
							window.setBackgroundColor(userColor.noFocus)
							window.clear()
							
							x, y = 3, 2
							n = 0
							t = 1
							
							for name in pairs(progs) do
								n = n + 1
								
								if n > 18 then
									n = 0
									t = t + 1
								end
								
								if t == tab then
								
									local dx, dy
				
									for i = 1,9 do
										dx = i
										dy = 0
										
										while dx > 3 do
											dx = dx - 3
											dy = dy + 1
										end
										
										window.setCursorPos(dx + x + 1, dy + y)
										window.setBackgroundColor(colorMenu[progs[name].iconColor:sub(i,i)])
										window.setTextColor(colorMenu[progs[name].iconTextColor:sub(i,i)])
										window.write(progs[name].iconText:sub(i,i))
									end
									
									window.setBackgroundColor(userColor.noFocus)	
									window.setTextColor(userColor.text)
									
									if #name > 7 then
										name = name:sub(1,5) .. ".."
										window.setCursorPos(x, y + 3)
										window.write(name:gsub("_", " "))
									else
										window.setCursorPos(x + 3 - math.floor(#name / 2), y + 3)
										window.write(name:gsub("_", " "))
									end
									
									x = x + 8
									
									if x + 6 > w then
										x = 3
										y = y + 5
									end
								end
							end
							
							break
						end
					end
				end
				
				local dx, dy
				
				for i = 1,9 do
					dx = i
					dy = 0
					
					while dx > 3 do
						dx = dx - 3
						dy = dy + 1
					end
					
					window.setCursorPos(dx + x + 1, dy + y)
					window.setBackgroundColor(color[progs[name].iconColor:sub(i,i)])
					window.setTextColor(color[progs[name].iconTextColor:sub(i,i)])
					window.write(progs[name].iconText:sub(i,i))
				end
				
				window.setBackgroundColor(userColor.back)	
				window.setTextColor(userColor.text)
				
				if #name > 7 then
					name = name:sub(1,5) .. ".."
					window.setCursorPos(x, y + 3)
					window.write(name:gsub("_", " "))
				else
					window.setCursorPos(x + 3 - math.floor(#name / 2), y + 3)
					window.write(name:gsub("_", " "))
				end
				
				x = x + 8
				
				if x + 6 > w then
					x = 3
					y = y + 5
				end
			end
		end
		
		if tab > 1 then
			window.setCursorPos(w / 2 - 3, h - 1)
			window.setBackgroundColor(userColor.windowDark)
			window.setTextColor(userColor.windowText)
			window.write(" < ")
			
			if event == "mouse_click" and mx >= w / 2 - 4 and mx <= w / 2 - 1 and my == h and not menu then
				tab = tab - 1
				window.setBackgroundColor(userColor.back)
				window.clear()
			end
		end
		
		if tab < tabs then
			window.setCursorPos(w / 2 + 3, h - 1)
			window.setBackgroundColor(userColor.windowDark)
			window.setTextColor(userColor.windowText)
			window.write(" > ")
			
			if event == "mouse_click" and mx >= w / 2 + 2 and mx <= w / 2 + 5 and my == h and not menu then
				tab = tab + 1
				window.setBackgroundColor(userColor.back)
				window.clear()
			end
		end
		
		if menu then
			window.setTextColor(userColor.windowText)
			window.setCursorPos(w / 2 - 6, h / 2 - 1)
			window.setBackgroundColor(userColor.window)
			window.write("              ")
			window.setBackgroundColor(userColor.windowDark)
			window.setCursorPos(w / 2 - 6, h / 2 - 1)
			
			if #menuProg > 12 then
				window.write(menuProg:sub(1,10):gsub("_", " ") .. "..")
			else
				window.write(menuProg:gsub("_", " "))
			end
			
			window.setCursorPos(w / 2 + 8, h / 2 - 1)
			window.setBackgroundColor(colors.red)
			window.setTextColor(colors.white)
			window.write("X")
			
			if menu == true then
				window.setTextColor(userColor.text)
				window.setCursorPos(w / 2 - 6, h / 2)
				window.setBackgroundColor(userColor.back)
				window.write("Move to Desktop")
				window.setCursorPos(w / 2 - 6, h / 2 + 1)
				window.write("Delete Program ")
			else
				window.setTextColor(userColor.text)
				window.setCursorPos(w / 2 - 6, h / 2)
				window.setBackgroundColor(userColor.back)
				window.write("    Delete?    ")
				window.setCursorPos(w / 2 - 6, h / 2 + 1)
				window.write("   Yes    No   ")
			end
			
			if event == "mouse_click" then
				if menu == true then
				
					if mx >= math.floor(w / 2 - 6) and mx <= math.floor(w / 2 + 9) and my == math.floor(h / 2 + 1) then
						local desktopFile = io.open("desktop", "a")
						desktopFile:write(menuProg .. "\n")
						desktopFile:close()
						desktopProgs[#desktopProgs + 1] = menuProg
						
						reloadList()
					elseif mx >= math.floor(w / 2 - 6) and mx <= math.floor(w / 2 + 9) and my == math.floor(h / 2 + 2) then
						menu = "delete"
					end
					
				else
				
					if mx >= math.floor(w / 2 - 3) and mx <= math.floor(w / 2 - 1) and my == math.floor(h / 2 + 2) then
						fs.delete("programs/" .. menuProg)
						reloadList()
					elseif mx >= math.floor(w / 2 + 4) and mx <= math.floor(w / 2 + 5) and my == math.floor(h / 2 + 2) then
						menu = true
					end
					
				end
				
				if (mx == math.floor(w / 2 + 8) and my == math.floor(h / 2)) or not menu then
					menu = false
					window.setBackgroundColor(userColor.back)
					window.clear()
					
					local x, y = 3, 2
					local n = 0
					local t = 1
					
					for name in pairs(progs) do
						n = n + 1
						
						if n > 18 then
							n = 0
							t = t + 1
						end
						
						if t == tab then
						
							local dx, dy
		
							for i = 1,9 do
								dx = i
								dy = 0
								
								while dx > 3 do
									dx = dx - 3
									dy = dy + 1
								end
								
								window.setCursorPos(dx + x + 1, dy + y)
								window.setBackgroundColor(color[progs[name].iconColor:sub(i,i)])
								window.setTextColor(color[progs[name].iconTextColor:sub(i,i)])
								window.write(progs[name].iconText:sub(i,i))
							end
							
							window.setBackgroundColor(userColor.back)	
							window.setTextColor(userColor.text)
							
							if #name > 7 then
								name = name:sub(1,5) .. ".."
								window.setCursorPos(x, y + 3)
								window.write(name:gsub("_", " "))
							else
								window.setCursorPos(x + 3 - math.floor(#name / 2), y + 3)
								window.write(name:gsub("_", " "))
							end
							
							x = x + 8
							
							if x + 6 > w then
								x = 3
								y = y + 5
							end
						end
					end
				end
			end
		end
	end
end