this is the final code submitted for this assignment. Only leaf nodes send data. Optimization to switch parents only after X number of packets have been forwarded to current parent.