XBee API two way communication (three nodes)

I have configured my Xbee Series 1 modules in API mode(2 nodes and 1 coordinator). The two way communication works perfectly fine between the coordinator and node 1 but as soon as I try to include node 2, the readings get messed up ( Sometimes node 1 prints, sometimes node 2). In short, the sequence is not in order.
Following are the attachments:

  1. A picture of my whole setup and how I want it to work.
  2. The readings which I am getting when I just include 1 node.
  3. The readings when I include all the 3 nodes.
  4. Arduino codes of node1, 2 and 3.
  5. Arduino code of coordinator.

coordinator_haiiiit.zip (1.39 KB)

rec1.zip (1.17 KB)

rec2.zip (1.16 KB)

rec3.zip (1.32 KB)

uint8_t payload1[7];
uint8_t payload2[7];
uint8_t payload3[7];

Only one XBee at a time can talk. You do NOT need three variables to hold the data from the ONE XBee.

You do not need three of some of the other things, either.

You have three nearly identical receive functions. What a waste. The data in the packet received tells you which XBee the data came from.