diff --git a/ffpb/ffpb-debug/files/bin/ffpb-debug b/ffpb/ffpb-debug/files/bin/ffpb-debug
index 1380ab2566915845c2137da11a1db296bc4ea302..ac59e2d4dd149cfe73c3a9a82ff927cc6f52ae1d 100755
--- a/ffpb/ffpb-debug/files/bin/ffpb-debug
+++ b/ffpb/ffpb-debug/files/bin/ffpb-debug
@@ -1,92 +1,132 @@
-#!/bin/sh
+#!/usr/bin/lua
 
+debugdata = ""
 ATH9K_DEBUGFS_DIR="/sys/kernel/debug/ieee80211/phy0/ath9k"
 
-local=false
-while getopts l opt
-do
-	case $opt in
-		l)
-			local=true;;
-	esac
-done
+-- wrapper for calling systemcommands
+function cmd(_command)
+	local f = io.popen(_command)
+	local l = f:read("*a")
+	f:close()
+	return "--- START COMMAND " .. _command .. " ---\n" .. l .. "--- END COMMAND " .. _command .. " ---\n\n"
+end
 
-if ! $local ; then
-	export tf="$(mktemp -t ffpb-debug.XXXXXX)"
-	exec 3>&2 >"$tf" 2>&1
-fi
+-- read contents of a given file
+function readFile(_file)
+	local f = io.open(_file, "r")
+	if f~=nil then
+		local l = f:read("*a")
+		f:close()
+		return "--- BEGIN OF FILE " .. _file .. " ---\n" .. l .. "--- END OF FILE " .. _file .. " ---\n\n"
+	else
+		return ""
+	end
+end
 
-sysinfo() {
-	echo -en "Hostname = "
-	uname -n
-	echo -en "Gluon Release = "
-	cat /lib/gluon/release
-	echo -en "Node Model = "
-	cat /tmp/sysinfo/model
-	echo -en "Uptime = "
-	uptime
-	echo -en "Timestamp = "
-	date
-}
+-- iterate through list
+function list_iter (_table)
+	local i = 0
+	local n = table.getn(_table)
+	return function ()
+		i = i + 1
+		if i <= n then return _table[i] end
+	end
+end
 
-cmd() {
-        echo "--- START $* ---"
-        "$@"
-        echo "--- END ($?) $* ---"
-        echo
-}
+localMode = false
 
-read_file_content() {
-	echo "--- START OF FILE CONTENT ($*) ---"
-	/bin/cat "$@"
-	echo "--- END OF FILE CONTENT ($*) ---"
-	echo
-}
+-- Should we enter local mode?
+if arg[1] == '-l' then
+	localMode = true
+end
 
-cmd sysinfo
-cmd ip addr show
-cmd ip route show
-cmd iw phy phy0 info
-cmd iw dev wlan0 info
-cmd iw dev wlan0 station dump
-cmd iw dev wlan0-1 station dump
-cmd /usr/bin/iwinfo phy0 scan
-cmd /usr/bin/iwinfo wlan0 info
-cmd /usr/bin/iwinfo wlan0-1 info
-cmd /usr/bin/iwinfo wlan0 assoclist
-cmd /usr/bin/iwinfo wlan0-1 assoclist
-if [ -d $ATH9K_DEBUGFS_DIR ] ; then
-	# data required for gluon "wifi blackout" bug-reports as requested in
-	# https://github.com/freifunk-gluon/gluon/issues/130 
-	for filename in reset queues interrupt ; do
-		read_file_content "${ATH9K_DEBUGFS_DIR}/${filename}"
-	done
-	sleep 10 && read_file_content "${ATH9K_DEBUGFS_DIR}/interrupt"
-	# ... and some additional debug data
-	for filename in ani base_eeprom dma dump_nfcal misc modal_eeprom phy_err recv xmit ; do
-		read_file_content "${ATH9K_DEBUGFS_DIR}/${filename}"
-	done
-fi
-cmd batctl gwl
-cmd batctl tl
-killall -USR1 fastd 2>/dev/null
-cmd logread
+-- search for existing debugreport.txt
+local debugFile = io.open("/tmp/debugreport.txt", "r")
+if debugFile==nil then
+	-- no existing debugreport, let's generate a new one
+	
+	-- inform the User ;)
+	print ('Hello, i will gather some information about your node now.')
+	print ('This may take some seconds, please stand by.')
+	
+	-- first of all, collect some generic information about the system
+	debugdata = debugdata .. cmd("uname -n")
+	debugdata = debugdata .. cmd("cat /lib/gluon/release")
+	debugdata = debugdata .. cmd("cat /tmp/sysinfo/model")
+	debugdata = debugdata .. cmd("uptime")
+	debugdata = debugdata .. cmd("date")
+	
+	-- now get some information about the network status
+	debugdata = debugdata .. cmd("ip addr show")
+	debugdata = debugdata .. cmd("ip route show")
+	
+	-- get wireless status
+	debugdata = debugdata .. cmd("iw phy phy0 info")
+	debugdata = debugdata .. cmd("iw dev wlan0 info")
+	debugdata = debugdata .. cmd("iw dev wlan0 station dump")
+	debugdata = debugdata .. cmd("iw dev wlan0-1 station dump")
+	debugdata = debugdata .. cmd("iwinfo phy0 scan")
+	debugdata = debugdata .. cmd("iwinfo wlan0 info")
+	debugdata = debugdata .. cmd("iwinfo wlan0-1 info")
+	debugdata = debugdata .. cmd("iwinfo wlan0 assoclist")
+	debugdata = debugdata .. cmd("iwinfo wlan0-1 assoclist")
+	
+	-- try to get some more information about wlan hardware status
+	_files = {"reset", "queues", "interrupt"}
+	for file in list_iter(_files) do
+		debugdata = debugdata .. readFile(ATH9K_DEBUGFS_DIR .. "/" .. file)
+	end
+	
+	-- sleep ten seconds and read interrupt again
+	os.execute("sleep 10")
+	debugdata = debugdata .. readFile(ATH9K_DEBUGFS_DIR .. "/interrupt")
+	
+	_files = {"ani", "base_eeprom", "dma", "dump_nfcal", "misc", "modal_eeprom", "phy_err", "recv", "xmit"}
+	for file in list_iter(_files) do
+		debugdata = debugdata .. readFile(ATH9K_DEBUGFS_DIR .. "/" .. file)
+	end
+	
+	-- get batman status
+	debugdata = debugdata .. cmd("batctl gwl") 
+	debugdata = debugdata .. cmd("batctl tl")
+	
+	-- finally get fastd status
+	os.execute("killall -USR1 fastd 2>/dev/null")
+	debugdata = debugdata .. cmd("logread")
+	
+	-- write debugreport to file
+	debugFile = io.open("/tmp/debugreport.txt", "w")
+	debugFile:write(debugdata)
+	debugFile:close()
+else
+	print('I found an old debugreport.')
+end
 
-if $local ; then
-	echo "No information has been sent to the ffpb-team."
+-- if local mode is requested print the report, otherwise send it to the admin team
+siteConfig = require("gluon.site_config")
+if localMode then
+	print ('As requested, i will not send the report, here it is:')
+	print (debugdata)
+	os.exit(0)
 else
-	exec >&3 2>&1
+	print('Sending report to Admin-Team ...')
+	local reportSent = false
+	local port = siteConfig.debugserver.port
+	for host in list_iter(siteConfig.debugserver.host) do
+		print('Trying ' .. host)
+		if os.execute("cat /tmp/debugreport.txt | nc " .. host .. " " .. port) and reportSent == false then
+			reportSent = true
+		end
+	end
 
-	echo "Sending report (stored in $tf) to ffpb-team ..."
-	HOST=$(lua -e 'print(require("gluon.site_config").debugserver.host)')
-	PORT=$(lua -e 'print(require("gluon.site_config").debugserver.port)')
-	code=`gzip -c $tf | nc $HOST $PORT`
-	if [ $? -eq 0 ]; then
-		echo "Report-ID: $code"
+	if reportSent then
+		print()
+		os.execute("rm /tmp/debugreport.txt")
+		print('Report was sent, the Adminteam has been informed.')
+		print('My job is done, good bye')
 	else
-		echo "Failed to send report :( but storing the file and sending it later \o/"
-		mkdir -p /var/cache/ff/debug
-		gzip -c "$tf" > /var/cache/ff/debug/stored.ff-debug.gz
-	fi
-	#TODO: rm "$tf"
-fi
+		print('Sorry, i could\'t send the report. I will try it again')
+		print('when this script will be invoked the next time.')
+		print('Good bye')
+	end
+end
diff --git a/ffpb/ffpb-debug/files/bin/ffpb-send-stored-debug b/ffpb/ffpb-debug/files/bin/ffpb-send-stored-debug
deleted file mode 100755
index f6bb9813402fcf571a3b48eb3d388f388c383ffb..0000000000000000000000000000000000000000
--- a/ffpb/ffpb-debug/files/bin/ffpb-send-stored-debug
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-#
-# Stefan Kloepping <northalpha@c3pb.de>
-#  --  Do 29 Mai 21:21:55 2014
-#
-stored_debug_file='/var/cache/ff/debug/stored.ff-debug.gz'
-
-#if file is not present, there is nothing to do
-if [ ! -f "{$stored_debug_file}" ];then
-	exit 0
-fi
-
-#send stored debug data to server
-HOST=$(lua -e 'print(require("gluon.site_config").debugserver.host)')
-PORT=$(lua -e 'print(require("gluon.site_config").debugserver.port)')
-code=$(nc $HOST $PORT < "${stored_debug_file}")
-if [ $? = 0 ]; then
-        echo "Report number: ${code}" > /var/cache/ff/debug/lastreport.code
-	rm -f -- "${stored_debug_file}"
-fi