original code by rmdijkman@wl500g.info at http://www.wl500g.info/showthread.php?t=1670
little changed by neonicus@gmail.com