diff --git a/common.c b/common.c
index 72d1160e2dcfbce9215adc45bcaaefc82867f491..e4fcc0cc45a96686f28ad477c290131360bb87ac 100644
--- a/common.c
+++ b/common.c
@@ -3,13 +3,13 @@
 int parse_and_print(char *dongle_response, struct ubus_context *ctx, struct ubus_request_data *req)
 {
 	if (!dongle_response) {
-		printf("no respose!\n");
+		DEBUG("no respose!\n");
 		goto fail;
 	}
 	struct json_object *parsed_response = json_tokener_parse(dongle_response);
 
 	if (!parsed_response) {
-		printf("No valid JSON, failed parsing!\n");
+		DEBUG("No valid JSON, failed parsing!\n");
 		goto free_response;
 	}
 	write_to_ubus(parsed_response, ctx, req);
diff --git a/dongle_apn.c b/dongle_apn.c
index a9c6c7e64b1a50a85f97e424e165dd97fc050d9e..a0466fa86a36ac1d7c9e255653c29869339fda10 100644
--- a/dongle_apn.c
+++ b/dongle_apn.c
@@ -44,7 +44,6 @@ int delete_apn_profile(struct ubus_context *ctx, struct ubus_object *obj,
 
 	blobmsg_parse(apn_policy, __APN_MAX, tb, blob_data(msg), blob_len(msg));
 	strncpy(name, (char *)blobmsg_data(tb[APN]), 1023);
-
 	char *response = mobile_delete_apn(name);
 
 	return parse_and_print(response, ctx, req);
@@ -91,11 +90,11 @@ int show_current_apn(struct ubus_context *ctx, struct ubus_object *obj,
 }
 
 struct ubus_method dongle_object_methods[] = {
-	UBUS_METHOD_NOARG("list_apn_profiles", list_apn_profiles),
-	UBUS_METHOD("create_apn_profile", create_apn_profile, apn_policy),
-	UBUS_METHOD("delete_apn_profile", delete_apn_profile, apn_policy),
-	UBUS_METHOD("set_apn_profile", set_apn_profile, apn_policy),
-	UBUS_METHOD_NOARG("show_current_apn", show_current_apn),
+	UBUS_METHOD_NOARG("list", list_apn_profiles),
+	UBUS_METHOD("create", create_apn_profile, apn_policy),
+	UBUS_METHOD("delete", delete_apn_profile, apn_policy),
+	UBUS_METHOD("set_profile", set_apn_profile, apn_policy),
+	UBUS_METHOD_NOARG("current", show_current_apn),
 };
 
 struct ubus_object_type dongle_object_type = UBUS_OBJECT_TYPE("dongle", dongle_object_methods);
diff --git a/dongle_network.c b/dongle_network.c
index 9c1503fa34b884d95aec333299351ef46e41c4e8..aa9857c240113104ca4a57747d117e19b97a87bd 100644
--- a/dongle_network.c
+++ b/dongle_network.c
@@ -81,7 +81,7 @@ int roam_status(struct ubus_context *ctx, struct ubus_object *obj,
 }
 
 struct ubus_method dongle_object_methods[] = {
-	UBUS_METHOD_NOARG("get_signal_strength", get_signal_strength),
+	UBUS_METHOD_NOARG("signal_strength", get_signal_strength),
 	UBUS_METHOD_NOARG("connect", connect_network),
 	UBUS_METHOD_NOARG("disconnect", disconnect),
 	UBUS_METHOD_NOARG("modem_state", modem_state),
diff --git a/dongle_pin.c b/dongle_pin.c
index 409cbccac5cc5c1d6d481c8ec5e9b098e486df22..7fea2f038cd5613e245031f75a7ec9df7d15d697 100644
--- a/dongle_pin.c
+++ b/dongle_pin.c
@@ -50,13 +50,13 @@ int isdigits(const char *pin)
 int validate_pin_format(char *pin)
 {
 	if (!isdigits(pin)) {
-		printf("Please enter digits only!\n");
+		DEBUG("Please enter digits only!\n");
 		goto fail;
 	} else if (strlen(pin) > 8 || strlen(pin) < 4) {
-		printf("Please enter between 4 to 8 digits!\n");
+		DEBUG("Please enter between 4 to 8 digits!\n");
 		goto fail;
 	} else if (atoi(pin) == 0) {
-		printf("0000 is not a valid pin! Lowest available is 0001\n");
+		DEBUG("0000 is not a valid pin! Lowest available is 0001\n");
 		goto fail;
 	}
 	return 0;
@@ -75,7 +75,7 @@ int set_pin(struct ubus_context *ctx, struct ubus_object *obj,
 	blobmsg_parse(set_pin_policy, __SET_PIN_MAX, tb, blob_data(msg), blob_len(msg));
 
 	if (!tb[NEW_PIN] && !tb[CURRENT_PIN]) {
-		printf("Please enter both a new pin and old pin!\n");
+		DEBUG("Please enter both a new pin and old pin!\n");
 		goto fail;
 	}
 
@@ -84,31 +84,31 @@ int set_pin(struct ubus_context *ctx, struct ubus_object *obj,
 
 	rv = validate_pin_format(new_pin);
 	if (rv > 0) {
-		printf("invalid pin\n");
+		DEBUG("invalid pin\n");
 		goto fail;
 	}
 	rv = validate_pin_format(current_pin);
 	if (rv > 0) {
-		printf("invalid pin\n");
+		DEBUG("invalid pin\n");
 		goto fail;
 	}
 	char *response = mobile_get_pin_status();
 
 	if (!response) {
-		printf("error getting pin_status\n");
+		DEBUG("error getting pin_status\n");
 		goto fail;
 	}
 	struct json_object *parsed_response = json_tokener_parse(response);
 
 	if (!parsed_response) {
-		printf("No valid JSON, failed parsing!\n");
+		DEBUG("No valid JSON, failed parsing!\n");
 		goto free_response;
 	}
 	struct json_object *rv_json;
 
 	json_object_object_get_ex(parsed_response, "pin_status", &rv_json);
 	if (!rv_json) {
-		printf("no pin_status available\n");
+		DEBUG("no pin_status available\n");
 		goto free_all;
 	}
 
@@ -117,17 +117,17 @@ int set_pin(struct ubus_context *ctx, struct ubus_object *obj,
 		json_object_put(parsed_response);
 		response = mobile_enable_pin(current_pin);
 		if (!response) {
-			printf("error enabling pin!\n");
+			DEBUG("error enabling pin!\n");
 			goto fail;
 		}
 		parsed_response = json_tokener_parse(response);
 		json_object_object_get_ex(parsed_response, "result", &rv_json);
 		if (!rv_json) {
-			printf("error getting result!\n");
+			DEBUG("error getting result!\n");
 			goto free_all;
 		}
 		if (strncmp(json_object_get_string(rv_json), "failure", strlen("failure")) == 0)
-			printf("Incorrect pin!\n");
+			DEBUG("Incorrect pin!\n");
 
 		free(response);
 	}
@@ -135,13 +135,13 @@ int set_pin(struct ubus_context *ctx, struct ubus_object *obj,
 	json_object_put(parsed_response);
 	response = mobile_set_pin(current_pin, new_pin);
 	if (!response) {
-		printf("error setting pin!\n");
+		DEBUG("error setting pin!\n");
 		goto fail;
 	}
 	parsed_response = json_tokener_parse(response);
 	json_object_object_get_ex(parsed_response, "result", &rv_json);
 	if (!rv_json) {
-		printf("no result available from set_pin!");
+		DEBUG("no result available from set_pin!");
 		goto free_all;
 	}
 	write_to_ubus(parsed_response, ctx, req);
@@ -164,32 +164,32 @@ int disable_pin(struct ubus_context *ctx, struct ubus_object *obj,
 
 	blobmsg_parse(pin_policy, __PIN_MAX, tb, blob_data(msg), blob_len(msg));
 	if (!tb[PIN]) {
-		printf("Please enter a pin!\n");
+		DEBUG("Please enter a pin!\n");
 		goto fail;
 	}
 	strncpy(pin, (char *)blobmsg_data(tb[PIN]), 9);
 	rv = validate_pin_format(pin);
 	if (rv < 0) {
-		printf("invalid pin format!\n");
+		DEBUG("invalid pin format!\n");
 		goto fail;
 	}
 	char *response = mobile_get_pin_status();
 
 	if (!response) {
-		printf("no response from get_pin_status!\n");
+		DEBUG("no response from get_pin_status!\n");
 		goto fail;
 	}
 	struct json_object *parsed_response = json_tokener_parse(response);
 
 	if (!parsed_response) {
-		printf("No valid JSON, failed parsing!\n");
+		DEBUG("No valid JSON, failed parsing!\n");
 		goto free_response;
 	}
 	struct json_object *rv_json;
 
 	json_object_object_get_ex(parsed_response, "pin_status", &rv_json);
 	if (!rv_json) {
-		printf("no pin_status available in response!\n");
+		DEBUG("no pin_status available in response!\n");
 		goto free_all;
 	}
 	if (json_object_get_int(rv_json)) {
@@ -198,19 +198,19 @@ int disable_pin(struct ubus_context *ctx, struct ubus_object *obj,
 		json_object_put(parsed_response);
 		response = mobile_disable_pin(pin);
 		if (!response) {
-			printf("eror disabling pin!\n");
+			DEBUG("eror disabling pin!\n");
 			goto fail;
 		}
 		parsed_response = json_tokener_parse(response);
 		json_object_object_get_ex(parsed_response, "result", &rv_json);
 		if (!rv_json) {
-			printf("no result available in response!\n");
+			DEBUG("no result available in response!\n");
 			goto free_all;
 		}
 		if (strncmp(json_object_get_string(rv_json), "failure", strlen("failure")) == 0)
-			printf("Incorrect pin!\n");
+			DEBUG("Incorrect pin!\n");
 	} else {
-		printf("already disabled!\n");
+		DEBUG("already disabled!\n");
 	}
 
 	write_to_ubus(parsed_response, ctx, req);
@@ -233,32 +233,32 @@ int enable_pin(struct ubus_context *ctx, struct ubus_object *obj,
 
 	blobmsg_parse(pin_policy, __PIN_MAX, tb, blob_data(msg), blob_len(msg));
 	if (!tb[PIN]) {
-		printf("Please enter both a new pin and old pin!\n");
+		DEBUG("Please enter both a new pin and old pin!\n");
 		goto fail;
 	}
 	strncpy(pin, (char *)blobmsg_data(tb[PIN]), 9);
 	rv = validate_pin_format(pin);
 	if (rv < 0) {
-		printf("invalid pin format!\n");
+		DEBUG("invalid pin format!\n");
 		goto fail;
 	}
 	char *response = mobile_get_pin_status();
 
 	if (!response) {
-		printf("no response from get_pin_status!\n");
+		DEBUG("no response from get_pin_status!\n");
 		goto fail;
 	}
 	struct json_object *parsed_response = json_tokener_parse(response);
 
 	if (!parsed_response) {
-		printf("No valid JSON, failed parsing!\n");
+		DEBUG("No valid JSON, failed parsing!\n");
 		goto free_response;
 	}
 	struct json_object *rv_json;
 
 	json_object_object_get_ex(parsed_response, "pin_status", &rv_json);
 	if (!rv_json) {
-		printf("no pin_status available in response!\n");
+		DEBUG("no pin_status available in response!\n");
 		goto free_all;
 	}
 	if (!json_object_get_int(rv_json)) {
@@ -267,19 +267,19 @@ int enable_pin(struct ubus_context *ctx, struct ubus_object *obj,
 		json_object_put(parsed_response);
 		response = mobile_enable_pin(pin);
 		if (!response) {
-			printf("no response from get_pin_status!\n");
+			DEBUG("no response from get_pin_status!\n");
 			goto fail;
 		}
 		parsed_response = json_tokener_parse(response);
 		json_object_object_get_ex(parsed_response, "result", &rv_json);
 		if (!rv_json) {
-			printf("no result available in response!\n");
+			DEBUG("no result available in response!\n");
 			goto free_all;
 		}
 		if (strncmp(json_object_get_string(rv_json), "failure", strlen("failure")) == 0)
-			printf("Incorrect pin!\n");
+			DEBUG("Incorrect pin!\n");
 	} else {
-		printf("already enabled!\n");
+		DEBUG("already enabled!\n");
 	}
 
 	write_to_ubus(parsed_response, ctx, req);
@@ -302,13 +302,13 @@ int verify_pin(struct ubus_context *ctx, struct ubus_object *obj,
 
 	blobmsg_parse(pin_policy, __PIN_MAX, tb, blob_data(msg), blob_len(msg));
 	if (!tb[PIN]) {
-		printf("Please enter a pin\n!");
+		DEBUG("Please enter a pin\n!");
 		goto fail;
 	}
 	strncpy(pin, (char *)blobmsg_data(tb[PIN]), 9);
 	rv = validate_pin_format(pin);
 	if (rv < 0) {
-		printf("invalid pin format!\n");
+		DEBUG("invalid pin format!\n");
 		goto fail;
 	}
 	char *response = mobile_set_pin(pin, pin);
@@ -323,7 +323,6 @@ int remaining_tries(struct ubus_context *ctx, struct ubus_object *obj,
 			   struct blob_attr *msg)
 {
 	char *response = mobile_get_pinnumber();
-	int rv;
 
 	return parse_and_print(response, ctx, req);
 }
diff --git a/libmobile.c b/libmobile.c
index e4fd1103564ae761a1104cccfa1c6aa6dcd178d4..67f250a2e62cb52030061f6cf034033c9a3153d1 100644
--- a/libmobile.c
+++ b/libmobile.c
@@ -31,16 +31,18 @@ size_t write_func(void *buffer, size_t size, size_t nmemb, void *userp)
 int apn_profile_idx(struct json_object *apn_profiles, char *name)
 {
 	int idx = 0;
-
-	json_object_object_foreach(apn_profiles, key, val)
-	{
+	json_object_object_foreach(apn_profiles, key, val) {
 		char *apn_profile = json_object_get_string(val);
+
+		if (strlen(apn_profile) <= 0)
+			break;
 		char *apn_name = strtok(apn_profile, "($)");
 
 		if (strncmp(apn_name, name, 1024) == 0)
 			return idx;
 		idx++;
 	}
+
 	return -1;
 }
 
@@ -85,11 +87,14 @@ char *mobile_delete_apn(char *name)
 	char *apn_profiles = mobile_get_apn_profiles();
 	struct json_object *apn_profiles_json = json_tokener_parse(apn_profiles);
 	char query[1024] = {0};
+
 	int idx = apn_profile_idx(apn_profiles_json, name);
 
 	free(apn_profiles);
-	if (idx < 0)
+	if (idx < 0) {
+		printf("APN not found in list!\n");
 		goto fail;
+	}
 
 	strncpy(query, "isTest=false&apn_action=delete&apn_mode=manual&index=", 1023);
 	sprintf(query + strlen(query), "%d", idx);
@@ -157,7 +162,6 @@ char *mobile_create_apn_profile(char *name)
 	strncat(query + strlen(query), "&wan_apn=", 1023);
 	strncat(query + strlen(query), name, 1023);
 	strncat(query + strlen(query), "&ppp_auth_mode=none&ppp_username=&ppp_passwd=&dns_mode=auto&prefer_dns_manual=&standby_dns_manual=", 1023);
-	printf("query: %s\n", query);
 
 	return mobile_post_request(query);
 }
diff --git a/libmobile.h b/libmobile.h
index 1f0db3474c5503ad876e77e02bf9a7fda05af560..a87f4160f308c9934c43f1df24d50bc5397d02d3 100644
--- a/libmobile.h
+++ b/libmobile.h
@@ -38,9 +38,9 @@
  *
  * The library calls will allocate memory for the dongle's response and return the pointer to this memory,
  * the caller is then responsible for freeing this memory by calling free(returned_pointer).
+ *
  ***************************************************/
 
-
 /**
  * Function: curl_cleaner
  *
@@ -80,7 +80,6 @@ size_t write_func(void *buffer, size_t size, size_t nmemb, void *userp);
  *		Index of the APN on success.
  *		-1 on failure.
  */
-
 int apn_profile_idx(struct json_object *apn_profiles, char *name);
 
 /**
@@ -105,6 +104,7 @@ int get_apn_profiles_len(void);
  *		NULL on failure.
  */
 char *mobile_connect_network(void);
+
 /**
  * Function: mobile_disconnect_network
  *