moving serial read code into a function doesn't give the expected results

thanks,

I changed the if Serial.available to while serial.available and seems to be doing what I need.

can you elaborate on how to implement this. I think I see how the "if serial.available" is not really what I need but I dont know enough about serial connection yet to understand how to have it grab what I need.

thanks