cleanup to networking code, still broken