MaxBotics HRXL-MaxSonar-WR 7380 working code, mm-resolution ultrasonic ranging

My research group is pushing hard into custom digital sensing of trails and campsites. Below is a bit of code I developed to measure trail surfaces to millimeter-resolution, about 5 times per second. The sensor we chose, the MaxBotics HRXL-MaxSonar-WR 7380, automagically corrects for temperature influences.  We can compare this against the laser ranging happening simultaneously and select the most accurate reading for a given trail surface (puddle vs. soil vs. gravel vs. organic matter, etc.).
/*  
    HRXL MaxSonar WR TTY serial communication example sketch
    Ultrasonic rangefinding

    Original bits by Logan Park, Ph.D., in honor of his astonishingly beautiful wife.

    Pretty much everything else is...
    based on: http://www.maxbotix.com/documents/HRXL-MaxSonar-WR_Datasheet.pdf
    and on the Arduino Mega 2560 ADK: http://arduino.cc/en/Main/ArduinoBoardADK
    and on this handy ASCII chart: http://www.csgnetwork.com/asciiset.html
    and a bunch of posts on the Arduino forums.

    1. Connect pin 5 (tty/serial) of the ranging unit to pin 19 (Serial1 RX) on the Mega 2560. 
    2. Connect pin 6 of the ranging unit to any 5V supply on the Mega 2560.
    3. Connect pin 7 of the ranging unit to any GND on the Mega 2560.
 */

int current_range_reading = -99;

void setup() 
{
  Serial.begin(115200); // Set your computer's serial terminal baud rate to this.
  Serial1.begin(9600); // This is what the MaxBotics TTY sonar output needs.
}

void loop() 
{
  if (Serial1.available() > 5)  // Then at least one complete range, 6 characters long, is stored in the RX buffer.
  {
    int inByte = Serial1.read(); // Examine the first stored character and decide what to do.

    if( inByte == 82 ) // "R" character 
    {
      int thousands = (Serial1.read() - '0') * 1000; // Take and convert each range digit to human-readable integer format.
      int hundreds = (Serial1.read() - '0') * 100;
      int tens = (Serial1.read() - '0') * 10;
      int units = (Serial1.read() - '0') * 1;
      int cr = Serial1.read(); // Don't do anything with this, just clear it out of the buffer with the rest.

      // Assemble the digits into the range integer.
      current_range_reading = thousands + hundreds + tens + units;
      if(current_range_reading == 300) //This is the minimum reading for the HRXL MaxSonar WR 7380, not the actual distance
      {
        Serial.println("too close!");
      }
      else if(current_range_reading == 5000) //This is the max reading for the HRXL MaxSonar WR 7380, not the actual distance
      {
        Serial.println("too far!");
      }
      else
      {
        Serial.print("Range (mm): "); 
        Serial.println(String(current_range_reading));
      } 
    }
    else if( inByte == 13 ) // Carriage Return  character, oops! 
    {
      //Serial.println();
    }
    else if( inByte == -1 ) // Just in case!  This shouldn't happen if Serial1.available() returns true.
    {
      Serial.println("RX buffer empty, wth?");
      return;
    }
  }
  else
  {
    //Serial.print("RX buffer not ready");  // This is very spammy, uncomment at your own risk.
  }
}