Xbee API handshaking

I have total 4 nodes (1 coordinator, 3 end devices). Each node has an arduino uno, xbee shield and xbee. I have already configured all the xbee’s in API mode.
The coordinator is attached to the computer and the other 3 nodes are being powered by batteries.
The two way communication between coordinator to a single end device is working fine. But, when I add the other nodes in the network, the communication is not in sequence.
Attached is my code and the readings that I am getting.

coordinator_haiiiit.zip (1.39 KB)

rec1.zip (1.17 KB)