Updated with minor tweaks including a good ref from networkstatic.net