XBee code and rework of protocol