More network code, code cleanup,