Merged Johns Xbee code.