Xbee Communication between 2 arduinos

So sorry about the late reply, but I finally got the setup working. Thanks for all your replies.
Just to clarify:
I had one battery-powered arduino UNO with an Xbee shield (1) which had some lights to be controlled connected on it's PWM outputs, communicating with an arduino UNO (without the microcontroller) with an Xbee shield (2) which was connected to the PC.
Then I had one battery powered Arduino Diecimila with an Xbee Shield (3) which had the sensors on its analog inputs, communicating with an arduino Diecimila (without the microcontroller) with an Xbee shield (4) which was connected to the PC.
What I wanted to do is to trigger the different sensors in '4' and these would in turn trigger and controll their respective lights in '1'. In order to do this I wrote a very simple program in Processing for the communication between the two modules. What I figured out on the way, and this might be of use to anyone who might have the same issues in the future, is that I had to configure the two pairs of Xbees in different baud rates for efficient communication. So I set '1' and '2' @ 115200 baud, while '3' and '4' @ 57600. I chose the highest ends to ensure that I had minimal latency in the signal transmission.
Still one thing that I cannot figure out is the following. Although everything works pretty smoothly, I don't understand one piece of code which was by accident. Let me elaborate:
This is the code that I wrote for the receiving end (1):

int light1=3;
int light2=5;
int light3=9;
int light4=11;

int val1;
int val2;
int val3;
int val4;
int val5;

void setup()
{
    Serial.begin(115200);  // the receiving end @ 115200
    pinMode(light1, OUTPUT);  // set light pins as outputs
    pinMode(light2, OUTPUT);  
    pinMode(light3, OUTPUT);  
    pinMode(light4, OUTPUT);       
}

void loop(){
    
    if (Serial.available()>0){
          val1=Serial.read(); // read the input from the Serial port (from the sensors)
          if (val1<10 || val1>255){ // shield the outputs from noise
            val1 = LOW;
          }
          analogWrite(light1,val1); //write the first value to the first light and so on..
          val2=Serial.read();
          if (val2<10 || val2>255){
            val2 = LOW;
          }
          analogWrite(light2,val2);
          val3=Serial.read();
          if (val3<10 || val3>255){
            val3 = LOW;
          }
          analogWrite(light3,val3);
          val4=Serial.read();
          if (val4<10 || val4>255){
            val4 = LOW;
          }
          analogWrite(light4,val4);
          val5=Serial.read();
    }
                
       //NO IDEA WHY THIS IS NEEDED ?!?!?!
        Serial.print("val1: ");
        Serial.print(val1);
        Serial.print(", val2: ");
        Serial.print(val2);
        Serial.print(", val3: ");
        Serial.print(val3);
        Serial.print(", val4: ");
        Serial.println(val4);
        
      
}

Note that the sending arduino '3' sent in every cycle 4 values (from each of the four sensors) plus one '/' to indicate the end of transmission per cycle. What I do not understand is that while I initially had the Serial.print lines just for debugging purposes and to monitor what was coming in, when I removed those the whole thing didn't work and the output pins were all set to HIGH apparently. Furthermore, even when I just left the Serial.print(val#) lines and commented the Serial.print(", val#: ") the thing still didn't work!!
I am happy that the whole thing worked in the end, but I am still baffled by this. Can someone help me understand the reason for this?
This is just for my own peace of mind..