     }
 
     uint16_t id = atoi(index);
-    gsmProcessSMS(id, sender, text);
+    gsm_process_sms(id, sender, text);
 
     p = strstr(p, "CMGL: ");
   };
 }
 
-int8_t gsmGetSignalQuality() {
-  gsmSendCommand_P(F("AT+CSQ"));
-
-  Serial.print(F("gsmSerialBuffer: "));
-  Serial.println(gsmSerialBuffer);
-
-  char* p = strstr(gsmSerialBuffer, "CSQ: ");
+int8_t gsm_get_signal_quality() {
+  gsm_send_command_P(F("AT+CSQ"));
+  
+  char* p = strstr(_gsm_serial_buffer, "CSQ: ");
 
   if (p) {
     p += 5;

    return 1;
  }

  if (!gsmSendCommand_P(F("AT+CMGF=1"))) {
    return 2;
  }

  if (!gsmSendCommand_P(F("AT+CPMS=\"SM\",\"SM\",\"SM\""))) {
    return 3;
  }

  gsmCheckSMS();

  eeprom_read_block((void*)&apn, (const void*)&apn_E, sizeof(apn) - 1);
  Serial.print(F("Using APN: "));
  Serial.println(apn);

  if (!gsmSendCommand_P(F("AT+CGATT?"))) {
    return 4;
  }

  if (!gsmSendCommand_P(F("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\""))) {
    return 5;
  }

  gsmSerial.listen();
  gsmSerial.print(F("AT+SAPBR=3,1,\"APN\",\""));
  gsmSerial.print(apn);
  gsmSerial.println(F("\""));

  if (!gsmSendCommand(0)) {
    return 6;
  }

  if (!gsmSendCommand_P(F("ATS0=1"))) {
    return 7;
  }

  return 0;
}

uint8_t gsmSendSMS(const char* destination, const char* text) {
  gsmSerial.listen();
  gsmSerial.print(F("AT+CMGS=\""));
  gsmSerial.print(destination);
  gsmSerial.println(F("\""));

  if (!gsmSendCommand(0, 2000, ">")) {
    return 1;
  }

  gsmSerial.print(text);
  gsmSerial.write(0x1A);
  gsmSerial.write(0x0D);
  gsmSerial.write(0x0A);

  if (!gsmSendCommand(0)) {
    return 2;
  }
}

void gsmProcessSMS(uint16_t id, const char* sender, char* text) {
  Serial.println(id);
  Serial.println(sender);
  Serial.println(text);

  char buffer[12];
  sprintf(buffer, "AT+CMGD=%u", id);
  gsmSendCommand(buffer);

  for (uint8_t i = 0; text[i]; ++i) {
    text[i] = tolower(text[i]);
  }

  if (strncmp_P(text, PSTR("reboot"), 6) == 0) {
    gsmSendSMS(sender, "OK");
    reboot();
  }



  Serial.println(F("Bekti Tracker 0.1.0"));

  _device_id = eeprom_read_word(&_device_id_E);
  Serial.print(F("Device ID: "));
  Serial.println(_device_id);

  _interval = eeprom_read_word(&_interval_E) * 1000;
  Serial.print(F("Update interval: "));
  Serial.println(_interval);

  Serial.begin(9600);
  _gps_serial.begin(9600);
  _gsm_serial.begin(9600);

  for (;;) {
    Serial.println(F("Initializing GSM... "));
    uint8_t ret = gsm_init();

    if (ret == 0) {
      Serial.println(F("OK"));
