Updated networking code (still a work in progress.)