Changes and cleaning up of the net code.
Fixed that the netcode sometimes abruptly stops.