add major code from openwifimap for link handling