   };
 }
 
-uint8_t gsmSendPOSTRequest(const char* url, const char* params) {
-  if (!gsmSendCommand_P(F("AT+SAPBR=1,1"), 10000)) {
+uint8_t gsm_send_post_request(const char* url, const char* params) {
+  if (!gsm_send_command_P(F("AT+SAPBR=1,1"), 10000)) {
     return 1;
   }
 
-  if (!gsmSendCommand_P(F("AT+SAPBR=2,1"))) {
+  if (!gsm_send_command_P(F("AT+SAPBR=2,1"))) {
     return 2;
   }
 
-  if (!gsmSendCommand_P(F("AT+HTTPINIT"))) {
+  if (!gsm_send_command_P(F("AT+HTTPINIT"))) {
     return 3;
   }
 
-  if (!gsmSendCommand_P(F("AT+HTTPPARA=\"CID\",1"))) {
+  if (!gsm_send_command_P(F("AT+HTTPPARA=\"CID\",1"))) {
     return 4;
   }
 
-  gsmSerial.listen();
-  gsmSerial.print(F("AT+HTTPPARA=\"URL\",\""));
-  gsmSerial.print(url);
-  gsmSerial.println(F("\""));
-
-  if (!gsmSendCommand(0)) {
+  _gsm_serial.listen();
+  _gsm_serial.print(F("AT+HTTPPARA=\"URL\",\""));
+  _gsm_serial.print(url);
+  _gsm_serial.println(F("\""));
+
+  if (!gsm_send_command(0)) {
     return 5;
   }
 
-  if (!gsmSendCommand("AT+HTTPPARA=\"UA\",\"bekti-tracker\"")) {
+  if (!gsm_send_command_P(F("AT+HTTPPARA=\"UA\",\"bekti-tracker\""))) {
     return 6;
   }
 
-  if (!gsmSendCommand("AT+HTTPPARA=\"CONTENT\",\"application/x-www-form-urlencoded\"")) {
+  if (!gsm_send_command_P(F("AT+HTTPPARA=\"CONTENT\",\"application/x-www-form-urlencoded\""))) {
     return 7;
   }
 
-  if (!gsmSendCommand("AT+HTTPPARA=\"TIMEOUT\",30")) {
+  if (!gsm_send_command_P(F("AT+HTTPPARA=\"TIMEOUT\",30"))) {
     return 8;
   }
 
-  char paramsBuffer[25];
-  uint16_t paramsLength = strlen(params);
-  sprintf(paramsBuffer, "AT+HTTPDATA=%d,10000", paramsLength);
-
-  if (!gsmSendCommand(paramsBuffer, 5000, "DOWNLOAD")) {
+  char params_buffer[25];
+  uint16_t params_length = strlen(params);
+  sprintf(params_buffer, "AT+HTTPDATA=%d,10000", params_length);
+
+  if (!gsm_send_command(params_buffer, 5000, "DOWNLOAD")) {
     return 9;
   }
 
-  gsmSerial.listen();
-  gsmSerial.print(params);
-
-  if (!gsmSendCommand(0)) {
+  _gsm_serial.listen();
+  _gsm_serial.print(params);
+
+  if (!gsm_send_command(0)) {
     return 10;
   }
 
-  if (!gsmSendCommand_P(F("AT+HTTPACTION=1"), 45000, "+HTTPACTION:")) {
+  if (!gsm_send_command_P(F("AT+HTTPACTION=1"), 45000, "+HTTPACTION:")) {
     return 11;
   }
 
-  if (!gsmSendCommand_P(F("AT+HTTPTERM"))) {
+  if (!gsm_send_command_P(F("AT+HTTPTERM"))) {
     return 12;
   }
 
-  if (!gsmSendCommand_P(F("AT+SAPBR=0,1"))) {
+  if (!gsm_send_command_P(F("AT+SAPBR=0,1"))) {
     return 13;
   }
 
   return 0;
 }
 
-void gsmPurgeSerialBuffer() {
-  while (gsmSerial.available())  {
-    gsmSerial.read();
-  }
-}
-
-uint8_t gsmSendCommand(const char* cmd, uint16_t timeout, const char* expected) {
-  gsmSerial.listen();
+void gsm_purge_serial_buffer() {
+  while (_gsm_serial.available())  {
+    _gsm_serial.read();
+  }
+}
+
+uint8_t gsm_send_command(const char* cmd, uint16_t timeout, const char* expected) {
+  _gsm_serial.listen();
 
   if (cmd) {
-    gsmPurgeSerialBuffer();
-    gsmSerial.println(cmd);
+    gsm_purge_serial_buffer();
+    _gsm_serial.println(cmd);
   }
 
   uint32_t t = millis();
   uint8_t n = 0;
 
   do {
-    if (gsmSerial.available()) {
-      char c = gsmSerial.read();
+    if (_gsm_serial.available()) {
+      char c = _gsm_serial.read();
       Serial.write(c);
 
-      if (n >= sizeof(gsmSerialBuffer) - 1) {
+      if (n >= sizeof(_gsm_serial_buffer) - 1) {
         // buffer full, discard first half
-        n = sizeof(gsmSerialBuffer) / 2 - 1;
-        memcpy(gsmSerialBuffer, gsmSerialBuffer + sizeof(gsmSerialBuffer) / 2, n);
+        n = sizeof(_gsm_serial_buffer) / 2 - 1;
+        memcpy(_gsm_serial_buffer, _gsm_serial_buffer + sizeof(_gsm_serial_buffer) / 2, n);
       }
 
-      gsmSerialBuffer[n++] = c;
-      gsmSerialBuffer[n] = 0;
-
-      if (strstr(gsmSerialBuffer, expected ? expected : "OK\r")) {
+      _gsm_serial_buffer[n++] = c;
+      _gsm_serial_buffer[n] = 0;
+
+      if (strstr(_gsm_serial_buffer, expected ? expected : "OK\r")) {
         return n;
       }
     }

    }

    int n = atoi(buffer);

    Serial.print(F("CSQ ATOI: "));
    Serial.println(n);
    
    return n;
  }

  return 0;
}

void gsmGetBatteryLevel(uint8_t* percentage, uint16_t* voltage) {
  gsmSendCommand_P(F("AT+CBC"));

  char *p = strstr(gsmSerialBuffer, "CBC: ");

  if (p) {
    p += 7;


  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"));
