 
 void update_nmea()
 {
-  while(Serial2.available() && (int) nmea_read_buffer.length() < MAX_NMEA_BUFFER)
+  bool keep_going = true;
+  while(Serial2.available() && (int) nmea_read_buffer.length() < MAX_NMEA_BUFFER && keep_going == true)
   {
      int incoming_byte = Serial2.read();
      if(incoming_byte == '\n')


void update_hsnmea()
{
  while(soft_serial.available() && (int) hsnmea_read_buffer.length() < MAX_NMEA_BUFFER)
  {
    int incoming_byte = soft_serial.read();
    if(incoming_byte == '\n')

      }
      #endif
      hsnmea_read_buffer = "";
      keep_going = false;
    }
    else if (incoming_byte == '\r')
    {
