Converted network stuff. Will rewrite this all tomorrow