Added lots more debugging and some sanity checking for networking