Restructured the code to send packets across the network.