Rewrote networking code to improve stability and reduce bandwidth usage