diff --git a/src/mod_netconf.c b/src/mod_netconf.c
index da007b5..f2e8a03 100644
--- a/src/mod_netconf.c
+++ b/src/mod_netconf.c
@@ -208,14 +208,14 @@
 {
 	json_object **err_reply_p = (json_object **) pthread_getspecific(err_reply_key);
 	if (err_reply_p == NULL) {
-		DEBUG("Error message was not allocated. %s", __func__);
+		ERROR("Error message was not allocated. %s", __func__);
 		return;
 	}
 	json_object *err_reply = *err_reply_p;
 
 	json_object *array = NULL;
 	if (err_reply == NULL) {
-		DEBUG("error calback: empty error list");
+		ERROR("error calback: empty error list");
 		pthread_mutex_lock(&json_lock);
 		err_reply = json_object_new_object();
 		array = json_object_new_array();
@@ -227,7 +227,7 @@
 		pthread_mutex_unlock(&json_lock);
 		(*err_reply_p) = err_reply;
 	} else {
-		DEBUG("error calback: nonempty error list");
+		ERROR("error calback: nonempty error list");
 		pthread_mutex_lock(&json_lock);
 		if (json_object_object_get_ex(err_reply, "errors", &array) == TRUE) {
 			if (message != NULL) {
@@ -253,13 +253,13 @@
 	struct nc_cpblts* cpblts = NULL;
 
 	if (s == NULL) {
-		DEBUG("No session given.");
+		ERROR("No session given.");
 		return;
 	}
 
 	pthread_mutex_lock(&json_lock);
 	if (s->hello_message != NULL) {
-		DEBUG("clean previous hello message");
+		ERROR("clean previous hello message");
 		//json_object_put(s->hello_message);
 		if (json_object_object_get_ex(s->hello_message, "sid", &js_tmp) == TRUE) {
 			j_old_sid = json_object_get_string(js_tmp);
@@ -297,7 +297,7 @@
 		}
 		DEBUG("%s", json_object_to_json_string(s->hello_message));
 	} else {
-		DEBUG("Session was not given.");
+		ERROR("Session was not given.");
 		json_object_object_add(s->hello_message, "type", json_object_new_int(REPLY_ERROR));
 		json_object_object_add(s->hello_message, "error-message", json_object_new_string("Invalid session identifier."));
 	}
@@ -310,11 +310,11 @@
 {
 	json_object **err_reply = calloc(1, sizeof(json_object **));
 	if (err_reply == NULL) {
-		DEBUG("Allocation of err_reply storage failed!");
+		ERROR("Allocation of err_reply storage failed!");
 		return;
 	}
 	if (pthread_setspecific(err_reply_key, err_reply) != 0) {
-		DEBUG("cannot set thread-specific value.");
+		ERROR("cannot set thread-specific value.");
 	}
 }
 
@@ -328,7 +328,7 @@
 			pthread_mutex_unlock(&json_lock);
 		}
 		if (pthread_setspecific(err_reply_key, err_reply) != 0) {
-			DEBUG("Cannot set thread-specific hash value.");
+			ERROR("Cannot set thread-specific hash value.");
 		}
 	}
 }
@@ -345,7 +345,7 @@
 		free(err_reply);
 		err_reply = NULL;
 		if (pthread_setspecific(err_reply_key, err_reply) != 0) {
-			DEBUG("Cannot set thread-specific hash value.");
+			ERROR("Cannot set thread-specific hash value.");
 		}
 	}
 }
@@ -387,7 +387,7 @@
 			session = NULL;
 			free(locked_session);
 			locked_session = NULL;
-			DEBUG("Creating structure session_with_mutex failed %d (%s)", errno, strerror(errno));
+			ERROR("Creating structure session_with_mutex failed %d (%s)", errno, strerror(errno));
 			return NULL;
 		}
 		locked_session->session = session;
@@ -401,7 +401,7 @@
 		if (pthread_rwlock_wrlock(&session_lock) != 0) {
 			nc_session_free(session);
 			free (locked_session);
-			DEBUG("Error while locking rwlock: %d (%s)", errno, strerror(errno));
+			ERROR("Error while locking rwlock: %d (%s)", errno, strerror(errno));
 			return NULL;
 		}
 		locked_session->notifications = apr_array_make(pool, NOTIFICATION_QUEUE_SIZE, sizeof(notification_t));
@@ -417,7 +417,7 @@
 		/* unlock session list */
 		DEBUG("UNLOCK wrlock %s", __func__);
 		if (pthread_rwlock_unlock (&session_lock) != 0) {
-			DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+			ERROR("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 		}
 
 		/* store information about session from hello message for future usage */
@@ -429,7 +429,7 @@
 		DEBUG("NETCONF session established");
 		return (session_key);
 	} else {
-		DEBUG("Connection could not be established");
+		ERROR("Connection could not be established");
 		return (NULL);
 	}
 
@@ -440,7 +440,7 @@
 	DEBUG("lock private lock.");
 	DEBUG("LOCK mutex %s", __func__);
 	if (pthread_mutex_lock(&locked_session->lock) != 0) {
-		DEBUG("Error while locking rwlock");
+		ERROR("Error while locking rwlock");
 	}
 	locked_session->ntfc_subscribed = 0;
 	locked_session->closed = 1;
@@ -452,7 +452,7 @@
 	DEBUG("unlock private lock.");
 	DEBUG("UNLOCK mutex %s", __func__);
 	if (pthread_mutex_unlock(&locked_session->lock) != 0) {
-		DEBUG("Error while locking rwlock");
+		ERROR("Error while locking rwlock");
 	}
 
 	DEBUG("unlock session lock.");
@@ -485,7 +485,7 @@
 	DEBUG("lock session lock.");
 	DEBUG("LOCK wrlock %s", __func__);
 	if (pthread_rwlock_wrlock (&session_lock) != 0) {
-		DEBUG("Error while locking rwlock");
+		ERROR("Error while locking rwlock");
 		(*reply) = create_error("Internal: Error while locking.");
 		return EXIT_FAILURE;
 	}
@@ -496,14 +496,14 @@
 
 	DEBUG("UNLOCK wrlock %s", __func__);
 	if (pthread_rwlock_unlock (&session_lock) != 0) {
-		DEBUG("Error while unlocking rwlock");
+		ERROR("Error while unlocking rwlock");
 		(*reply) = create_error("Internal: Error while unlocking.");
 	}
 
 	if ((locked_session != NULL) && (locked_session->session != NULL)) {
 		return close_and_free_session(locked_session);
 	} else {
-		DEBUG("Unknown session to close");
+		ERROR("Unknown session to close");
 		(*reply) = create_error("Internal: Unkown session to close.");
 		return (EXIT_FAILURE);
 	}
@@ -528,7 +528,7 @@
 	switch (msgt) {
 		case NC_MSG_UNKNOWN:
 			if (nc_session_get_status(session) != NC_SESSION_STATUS_WORKING) {
-				DEBUG("mod_netconf: receiving rpc-reply failed");
+				ERROR("mod_netconf: receiving rpc-reply failed");
 				if (session_key != NULL) {
 					netconf_close(session_key, &err);
 				}
@@ -554,21 +554,21 @@
 					return create_ok();
 				case NC_REPLY_DATA:
 					if (((*data) = nc_reply_get_data(reply)) == NULL) {
-						DEBUG("mod_netconf: no data from reply");
+						ERROR("mod_netconf: no data from reply");
 						return create_error("Internal: No data from reply received.");
 					} else {
 						return NULL;
 					}
 					break;
 				case NC_REPLY_ERROR:
-					DEBUG("mod_netconf: unexpected rpc-reply (%d)", replyt);
+					ERROR("mod_netconf: unexpected rpc-reply (%d)", replyt);
 					if (data != NULL) {
 						free(*data);
 						(*data) = NULL;
 					}
 					return create_error(nc_reply_get_errormsg(reply));
 				default:
-					DEBUG("mod_netconf: unexpected rpc-reply (%d)", replyt);
+					ERROR("mod_netconf: unexpected rpc-reply (%d)", replyt);
 					if (data != NULL) {
 						free(*data);
 						(*data) = NULL;
@@ -577,7 +577,7 @@
 			}
 			break;
 		default:
-			DEBUG("mod_netconf: unexpected reply message received (%d)", msgt);
+			ERROR("mod_netconf: unexpected reply message received (%d)", msgt);
 			if (data != NULL) {
 				free(*data);
 				(*data) = NULL;
@@ -593,7 +593,7 @@
 
 	/* check requests */
 	if (rpc == NULL) {
-		DEBUG("mod_netconf: rpc is not created");
+		ERROR("mod_netconf: rpc is not created");
 		return create_error("Internal error: RPC is not created");
 	}
 
@@ -603,7 +603,7 @@
 		/* process the result of the operation */
 		return netconf_test_reply(session, NULL, msgt, reply, NULL);
 	} else {
-		DEBUG("Unknown session to process.");
+		ERROR("Unknown session to process.");
 		return create_error("Internal error: Unknown session to process.");
 	}
 }
@@ -627,7 +627,7 @@
 
 	/* check requests */
 	if (rpc == NULL) {
-		DEBUG("mod_netconf: rpc is not created");
+		ERROR("mod_netconf: rpc is not created");
 		res = create_error("Internal: RPC could not be created.");
 		data = NULL;
 		goto finished;
@@ -636,7 +636,7 @@
 	/* get non-exclusive (read) access to sessions_list (conns) */
 	DEBUG("LOCK wrlock %s", __func__);
 	if (pthread_rwlock_rdlock(&session_lock) != 0) {
-		DEBUG("Error while locking rwlock: %d (%s)", errno, strerror(errno));
+		ERROR("Error while locking rwlock: %d (%s)", errno, strerror(errno));
 		res = create_error("Internal: Lock failed.");
 		data = NULL;
 		goto finished;
@@ -654,7 +654,7 @@
 			DEBUG("UNLOCK wrlock %s", __func__);
 			if (pthread_rwlock_unlock (&session_lock) != 0) {
 
-				DEBUG("Error while locking rwlock: %d (%s)", errno, strerror(errno));
+				ERROR("Error while locking rwlock: %d (%s)", errno, strerror(errno));
 				res = create_error("Internal: Could not unlock.");
 				goto finished;
 			}
@@ -663,7 +663,7 @@
 		DEBUG("UNLOCK wrlock %s", __func__);
 		if (pthread_rwlock_unlock(&session_lock) != 0) {
 
-			DEBUG("Error while locking rwlock: %d (%s)", errno, strerror(errno));
+			ERROR("Error while locking rwlock: %d (%s)", errno, strerror(errno));
 			res = create_error("Internal: Could not unlock.");
 		}
 
@@ -682,9 +682,9 @@
 		/* release lock on failure */
 		DEBUG("UNLOCK wrlock %s", __func__);
 		if (pthread_rwlock_unlock(&session_lock) != 0) {
-			DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+			ERROR("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 		}
-		DEBUG("Unknown session to process.");
+		ERROR("Unknown session to process.");
 		res = create_error("Unknown session to process.");
 		data = NULL;
 	}
@@ -717,7 +717,7 @@
 	rpc = nc_rpc_getconfig (source, f);
 	nc_filter_free(f);
 	if (rpc == NULL) {
-		DEBUG("mod_netconf: creating rpc request failed");
+		ERROR("mod_netconf: creating rpc request failed");
 		return (NULL);
 	}
 
@@ -728,7 +728,7 @@
 	if (nc_rpc_capability_attr(rpc, NC_CAP_ATTR_WITHDEFAULTS_MODE, NCWD_MODE_NOTSET)) {
 	//if (nc_rpc_capability_attr(rpc, NC_CAP_ATTR_WITHDEFAULTS_MODE, NCWD_MODE_ALL)) {
 #endif
-		DEBUG("mod_netconf: setting withdefaults failed");
+		ERROR("mod_netconf: setting withdefaults failed");
 	}
 
 	res = netconf_op(session_key, rpc, &data);
@@ -751,7 +751,7 @@
 	/* create requests */
 	rpc = nc_rpc_getschema(identifier, version, format);
 	if (rpc == NULL) {
-		DEBUG("mod_netconf: creating rpc request failed");
+		ERROR("mod_netconf: creating rpc request failed");
 		return (NULL);
 	}
 
@@ -782,7 +782,7 @@
 	rpc = nc_rpc_get (f);
 	nc_filter_free(f);
 	if (rpc == NULL) {
-		DEBUG("mod_netconf: creating rpc request failed");
+		ERROR("mod_netconf: creating rpc request failed");
 		return (NULL);
 	}
 
@@ -790,7 +790,7 @@
 	if (nc_rpc_capability_attr(rpc, NC_CAP_ATTR_WITHDEFAULTS_MODE, NCWD_MODE_NOTSET)) {
 	//if (nc_rpc_capability_attr(rpc, NC_CAP_ATTR_WITHDEFAULTS_MODE, NCWD_MODE_ALL)) {
 	//if (nc_rpc_capability_attr(rpc, NC_CAP_ATTR_WITHDEFAULTS_MODE, NCWD_MODE_ALL_TAGGED)) {
-		DEBUG("mod_netconf: setting withdefaults failed");
+		ERROR("mod_netconf: setting withdefaults failed");
 	}
 
 	res = netconf_op(session_key, rpc, &data);
@@ -836,7 +836,7 @@
 		}
 	}
 	if (rpc == NULL) {
-		DEBUG("mod_netconf: creating rpc request failed");
+		ERROR("mod_netconf: creating rpc request failed");
 		return create_error("Internal: Creating rpc request failed");
 	}
 
@@ -854,7 +854,7 @@
 	/* create requests */
 	rpc = nc_rpc_editconfig(target, source, defop, erropt, testopt, config_or_url);
 	if (rpc == NULL) {
-		DEBUG("mod_netconf: creating rpc request failed");
+		ERROR("mod_netconf: creating rpc request failed");
 		return create_error("Internal: Creating rpc request failed");
 	}
 
@@ -872,7 +872,7 @@
 	/* create requests */
 	rpc = nc_rpc_killsession(sid);
 	if (rpc == NULL) {
-		DEBUG("mod_netconf: creating rpc request failed");
+		ERROR("mod_netconf: creating rpc request failed");
 		return create_error("Internal: Creating rpc request failed");
 	}
 
@@ -889,7 +889,7 @@
 	/* create requests */
 	rpc = op_func(target);
 	if (rpc == NULL) {
-		DEBUG("mod_netconf: creating rpc request failed");
+		ERROR("mod_netconf: creating rpc request failed");
 		return create_error("Internal: Creating rpc request failed");
 	}
 
@@ -908,7 +908,7 @@
 		rpc = nc_rpc_deleteconfig(target, url);
 	}
 	if (rpc == NULL) {
-		DEBUG("mod_netconf: creating rpc request failed");
+		ERROR("mod_netconf: creating rpc request failed");
 		return create_error("Internal: Creating rpc request failed");
 	}
 
@@ -935,7 +935,7 @@
 	/* create requests */
 	rpc = nc_rpc_generic(content);
 	if (rpc == NULL) {
-		DEBUG("mod_netconf: creating rpc request failed");
+		ERROR("mod_netconf: creating rpc request failed");
 		return create_error("Internal: Creating rpc request failed");
 	}
 
@@ -957,13 +957,17 @@
 void clb_print(NC_VERB_LEVEL level, const char* msg)
 {
 #define FOREACH(I) \
-        I(NC_VERB_ERROR) I(NC_VERB_WARNING) \
-        I(NC_VERB_VERBOSE) I(NC_VERB_DEBUG)
-#define CASE(VAL) case VAL: DEBUG("%s: %s", #VAL, msg); \
+        I(NC_VERB_ERROR) I(NC_VERB_WARNING)
+
+#define CASE(VAL) case VAL: ERROR("%s: %s", #VAL, msg); \
 	break;
 
 	switch (level) {
-	FOREACH(CASE)
+	FOREACH(CASE);
+	case NC_VERB_VERBOSE:
+	case NC_VERB_DEBUG:
+		DEBUG("DEBUG: %s", msg);
+		break;
 	}
 	if (level == NC_VERB_ERROR) {
 		/* return global error */
@@ -1023,7 +1027,7 @@
 			}
 			chunk_len_str[i++] = c;
 			if (i==11) {
-				DEBUG("Message is too long, buffer for length is not big enought!!!!");
+				ERROR("Message is too long, buffer for length is not big enought!!!!");
 				break;
 			}
 		}
@@ -1159,7 +1163,7 @@
 				nc_cpblts_add(cpblts, json_object_get_string(json_object_array_get_idx(capabilities, i)));
 			}
 		} else {
-			DEBUG("no capabilities specified");
+			ERROR("no capabilities specified");
 		}
 		json_object_put(capabilities);
 	}
@@ -1168,7 +1172,7 @@
 
 	DEBUG("host: %s, port: %s, user: %s", host, port, user);
 	if ((host == NULL) || (user == NULL)) {
-		DEBUG("Cannot connect - insufficient input.");
+		ERROR("Cannot connect - insufficient input.");
 		session_key_hash = NULL;
 	} else {
 		session_key_hash = netconf_connect(pool, host, port, user, pass, cpblts);
@@ -1187,11 +1191,11 @@
 			reply = json_object_new_object();
 			json_object_object_add(reply, "type", json_object_new_int(REPLY_ERROR));
 			json_object_object_add(reply, "error-message", json_object_new_string("Connecting NETCONF server failed."));
-			DEBUG("Connection failed.");
+			ERROR("Connection failed.");
 		} else {
 			/* use filled err_reply from libnetconf's callback */
 			reply = err_reply;
-			DEBUG("Connect - error from libnetconf's callback.");
+			ERROR("Connect - error from libnetconf's callback.");
 		}
 	} else {
 		/* positive reply */
@@ -1557,7 +1561,7 @@
 
 	DEBUG("LOCK wrlock %s", __func__);
 	if (pthread_rwlock_wrlock(&session_lock) != 0) {
-		DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+		ERROR("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 		return NULL;
 	}
 
@@ -1580,12 +1584,12 @@
 		pthread_mutex_unlock(&locked_session->lock);
 		DEBUG("UNLOCK wrlock %s", __func__);
 		if (pthread_rwlock_unlock(&session_lock) != 0) {
-			DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+			ERROR("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 		}
 	} else {
 		DEBUG("UNLOCK wrlock %s", __func__);
 		if (pthread_rwlock_unlock(&session_lock) != 0) {
-			DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+			ERROR("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 		}
 		reply = create_error("Invalid session identifier.");
 	}
@@ -1604,7 +1608,7 @@
 
 	DEBUG("LOCK wrlock %s", __func__);
 	if (pthread_rwlock_rdlock(&session_lock) != 0) {
-		DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+		ERROR("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 	}
 
 	locked_session = (struct session_with_mutex *) apr_hash_get(netconf_sessions_list, session_key, APR_HASH_KEY_STRING);
@@ -1613,7 +1617,7 @@
 		pthread_mutex_lock(&locked_session->lock);
 		DEBUG("UNLOCK wrlock %s", __func__);
 		if (pthread_rwlock_unlock(&session_lock) != 0) {
-			DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+			ERROR("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 		}
 		if (locked_session->hello_message != NULL) {
 			reply = locked_session->hello_message;
@@ -1625,7 +1629,7 @@
 	} else {
 		DEBUG("UNLOCK wrlock %s", __func__);
 		if (pthread_rwlock_unlock(&session_lock) != 0) {
-			DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+			ERROR("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 		}
 		reply = create_error("Invalid session identifier.");
 	}
@@ -1638,14 +1642,14 @@
 {
 	json_object *notif_history_array = (json_object *) pthread_getspecific(notif_history_key);
 	if (notif_history_array == NULL) {
-		DEBUG("No list of notification history found.");
+		ERROR("No list of notification history found.");
 		return;
 	}
 	DEBUG("Got notification from history %lu.", (long unsigned) eventtime);
 	pthread_mutex_lock(&json_lock);
 	json_object *notif = json_object_new_object();
 	if (notif == NULL) {
-		DEBUG("Could not allocate memory for notification (json).");
+		ERROR("Could not allocate memory for notification (json).");
 		goto failed;
 	}
 	json_object_object_add(notif, "eventtime", json_object_new_int64(eventtime));
@@ -1694,7 +1698,7 @@
 
 	DEBUG("LOCK wrlock %s", __func__);
 	if (pthread_rwlock_rdlock(&session_lock) != 0) {
-		DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+		ERROR("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 		reply = create_error("Internal lock failed.");
 		goto finalize;
 	}
@@ -1705,7 +1709,7 @@
 		pthread_mutex_lock(&locked_session->lock);
 		DEBUG("UNLOCK wrlock %s", __func__);
 		if (pthread_rwlock_unlock(&session_lock) != 0) {
-			DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+			ERROR("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 		}
 		DEBUG("creating temporal NC session.");
 		temp_session = nc_session_connect_channel(locked_session->session, NULL);
@@ -1739,7 +1743,7 @@
 			json_object *notif_history_array = json_object_new_array();
 			pthread_mutex_unlock(&json_lock);
 			if (pthread_setspecific(notif_history_key, notif_history_array) != 0) {
-				DEBUG("notif_history: cannot set thread-specific hash value.");
+				ERROR("notif_history: cannot set thread-specific hash value.");
 			}
 
 			ncntf_dispatch_receive(temp_session, notification_history);
@@ -1764,7 +1768,7 @@
 	} else {
 		DEBUG("UNLOCK wrlock %s", __func__);
 		if (pthread_rwlock_unlock(&session_lock) != 0) {
-			DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+			ERROR("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 		}
 		reply = create_error("Invalid session identifier.");
 	}
@@ -1864,7 +1868,6 @@
 
 		if (status == 0 || (status == -1 && (errno == EAGAIN || (errno == EINTR && isterminated == 0)))) {
 			/* poll was interrupted - check if the isterminated is set and if not, try poll again */
-			//DEBUG("poll interrupted");
 			continue;
 		} else if (status < 0) {
 			/* 0:  poll time outed
@@ -1872,7 +1875,6 @@
 			 * -1: poll failed
 			 *     something wrong happend, close this socket and wait for another request
 			 */
-			//DEBUG("poll failed, status %d(%d: %s)", status, errno, strerror(errno));
 			close(client);
 			break;
 		}
@@ -1883,7 +1885,6 @@
 		/* if nothing to read and POLLHUP (EOF) or POLLERR set */
 		if ((fds.revents & POLLHUP) || (fds.revents & POLLERR)) {
 			/* close client's socket (it's probably already closed by client */
-			//DEBUG("socket error (%d)", fds.revents);
 			close(client);
 			break;
 		}
@@ -1897,7 +1898,7 @@
 			pthread_mutex_lock(&json_lock);
 			request = json_tokener_parse_verbose(buffer, &jerr);
 			if (jerr != json_tokener_success) {
-				DEBUG("JSON parsing error");
+				ERROR("JSON parsing error");
 				pthread_mutex_unlock(&json_lock);
 				continue;
 			}
@@ -2079,7 +2080,7 @@
 				pthread_mutex_unlock(&json_lock);
 				clean_err_reply();
 			} else {
-				DEBUG("Reply is NULL, shouldn't be...");
+				ERROR("Reply is NULL, shouldn't be...");
 				continue;
 			}
 		}
@@ -2113,7 +2114,7 @@
 	/* get exclusive access to sessions_list (conns) */
 	DEBUG("LOCK wrlock %s", __func__);
 	if ((ret = pthread_rwlock_wrlock (&session_lock)) != 0) {
-		DEBUG("Error while locking rwlock: %d (%s)", ret, strerror(ret));
+		ERROR("Error while locking rwlock: %d (%s)", ret, strerror(ret));
 		return;
 	}
 	for (hi = apr_hash_first(p, netconf_sessions_list); hi; hi = apr_hash_next(hi)) {
@@ -2134,7 +2135,7 @@
 	/* get exclusive access to sessions_list (conns) */
 	DEBUG("UNLOCK wrlock %s", __func__);
 	if (pthread_rwlock_unlock (&session_lock) != 0) {
-		DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+		ERROR("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 	}
 }
 
@@ -2150,7 +2151,6 @@
 	int ret;
 
 	/* get exclusive access to sessions_list (conns) */
-//DEBUG("LOCK wrlock %s", __func__);
 	if ((ret = pthread_rwlock_wrlock(&session_lock)) != 0) {
 		DEBUG("Error while locking rwlock: %d (%s)", ret, strerror(ret));
 		return;
@@ -2165,26 +2165,22 @@
 		if (ns == NULL) {
 			continue;
 		}
-//DEBUG("LOCK mutex %s", __func__);
 		pthread_mutex_lock(&swm->lock);
 		if ((current_time - swm->last_activity) > apr_time_from_sec(ACTIVITY_TIMEOUT)) {
 			DEBUG("Closing NETCONF session (%s).", hashed_key);
 			/* remove session from the active sessions list */
 			apr_hash_set(netconf_sessions_list, hashed_key, APR_HASH_KEY_STRING, NULL);
-//DEBUG("UNLOCK mutex %s", __func__);
 			pthread_mutex_unlock(&swm->lock);
 
 			/* close_and_free_session handles locking on its own */
 			close_and_free_session(swm);
 		} else {
-//DEBUG("UNLOCK mutex %s", __func__);
 			pthread_mutex_unlock(&swm->lock);
 		}
 	}
 	/* get exclusive access to sessions_list (conns) */
-//DEBUG("UNLOCK wrlock %s", __func__);
 	if (pthread_rwlock_unlock(&session_lock) != 0) {
-		DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+		ERROR("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 	}
 }
 
@@ -2228,12 +2224,12 @@
 	if (strlen(SU_GROUP) > 0) {
 		struct group *g = getgrnam(SU_GROUP);
 		if (g == NULL) {
-			DEBUG("GID (%s) was not found.", SU_GROUP);
+			ERROR("GID (%s) was not found.", SU_GROUP);
 			return;
 		}
 		if (setgid(g->gr_gid) != 0) {
 
-			DEBUG("Switching to %s GID failed. (%s)", SU_GROUP, strerror(errno));
+			ERROR("Switching to %s GID failed. (%s)", SU_GROUP, strerror(errno));
 			return;
 		}
 	}
@@ -2244,11 +2240,11 @@
 	if (strlen(SU_USER) > 0) {
 		struct passwd *p = getpwnam(SU_USER);
 		if (p == NULL) {
-			DEBUG("UID (%s) was not found.", SU_USER);
+			ERROR("UID (%s) was not found.", SU_USER);
 			return;
 		}
 		if (setuid(p->pw_uid) != 0) {
-			DEBUG("Switching to UID %s failed. (%s)", SU_USER, strerror(errno));
+			ERROR("Switching to UID %s failed. (%s)", SU_USER, strerror(errno));
 			return;
 		}
 	}
@@ -2260,7 +2256,7 @@
 	if (server != NULL) {
 		cfg = ap_get_module_config(server->module_config, &netconf_module);
 		if (cfg == NULL) {
-			DEBUG("Getting mod_netconf configuration failed");
+			ERROR("Getting mod_netconf configuration failed");
 			return;
 		}
 		sockname = cfg->sockname;
@@ -2273,7 +2269,7 @@
 
 	/* create listening UNIX socket to accept incoming connections */
 	if ((lsock = socket(PF_UNIX, SOCK_STREAM, 0)) == -1) {
-		DEBUG("Creating socket failed (%s)", strerror(errno));
+		ERROR("Creating socket failed (%s)", strerror(errno));
 		goto error_exit;
 	}
 
@@ -2283,15 +2279,15 @@
 
 	if (bind(lsock, (struct sockaddr *) &local, len) == -1) {
 		if (errno == EADDRINUSE) {
-			DEBUG("mod_netconf socket address already in use");
+			ERROR("mod_netconf socket address already in use");
 			goto error_exit;
 		}
-		DEBUG("Binding socket failed (%s)", strerror(errno));
+		ERROR("Binding socket failed (%s)", strerror(errno));
 		goto error_exit;
 	}
 
 	if (listen(lsock, MAX_SOCKET_CL) == -1) {
-		DEBUG("Setting up listen socket failed (%s)", strerror(errno));
+		ERROR("Setting up listen socket failed (%s)", strerror(errno));
 		goto error_exit;
 	}
 	chmod(sockname, S_IWUSR | S_IWGRP | S_IWOTH | S_IRUSR | S_IRGRP | S_IROTH);
@@ -2311,7 +2307,7 @@
 		}
 	}
 	if (chown(sockname, user, group) == -1) {
-		DEBUG("Chown on socket file failed (%s).", strerror(errno));
+		ERROR("Chown on socket file failed (%s).", strerror(errno));
 	}
 
 	/* prepare internal lists */
@@ -2319,7 +2315,7 @@
 
 	#ifdef WITH_NOTIFICATIONS
 	if (notification_init(pool, server) == -1) {
-		DEBUG("libwebsockets initialization failed");
+		ERROR("libwebsockets initialization failed");
 		use_notifications = 0;
 	} else {
 		use_notifications = 1;
@@ -2343,18 +2339,17 @@
 	pthread_rwlockattr_setpshared(&lock_attrs, PTHREAD_PROCESS_PRIVATE);
 	/* create rw lock */
 	if (pthread_rwlock_init(&session_lock, &lock_attrs) != 0) {
-		DEBUG("Initialization of mutex failed: %d (%s)", errno, strerror(errno));
+		ERROR("Initialization of mutex failed: %d (%s)", errno, strerror(errno));
 		goto error_exit;
 	}
 	pthread_mutex_init(&ntf_history_lock, NULL);
 	pthread_mutex_init(&json_lock, NULL);
-	DEBUG("init of notif_history_key.");
+	DEBUG("Initialization of notification history.");
 	if (pthread_key_create(&notif_history_key, NULL) != 0) {
-		DEBUG("init of notif_history_key failed");
+		ERROR("Initialization of notification history failed.");
 	}
-	DEBUG("init of err_reply_key.");
 	if (pthread_key_create(&err_reply_key, NULL) != 0) {
-		DEBUG("init of err_reply_key failed");
+		ERROR("Initialization of reply key failed.");
 	}
 
 	fcntl(lsock, F_SETFL, fcntl(lsock, F_GETFL, 0) | O_NONBLOCK);
@@ -2362,9 +2357,6 @@
 		gettimeofday(&tv, NULL);
 		timediff = (unsigned int)tv.tv_sec - olds;
 		#ifdef WITH_NOTIFICATIONS
-		if (timediff > 60) {
-			DEBUG("handling notifications");
-		}
 		if (use_notifications == 1) {
 			notification_handle();
 		}
@@ -2375,10 +2367,6 @@
 
 		/* open incoming connection if any */
 		len = sizeof(remote);
-		if (((unsigned int)tv.tv_sec - olds) > 60) {
-			DEBUG("accepting another client");
-			olds = tv.tv_sec;
-		}
 		client = accept(lsock, (struct sockaddr *) &remote, &len);
 		if (client == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) {
 			apr_sleep(SLEEP_TIME);
@@ -2386,7 +2374,7 @@
 		} else if (client == -1 && (errno == EINTR)) {
 			continue;
 		} else if (client == -1) {
-			DEBUG("Accepting mod_netconf client connection failed (%s)", strerror(errno));
+			ERROR("Accepting mod_netconf client connection failed (%s)", strerror(errno));
 			continue;
 		}
 
@@ -2401,7 +2389,7 @@
 
 		/* start new thread. It will serve this particular request and then terminate */
 		if ((ret = pthread_create (&ptids[pthread_count], NULL, thread_routine, (void*)arg)) != 0) {
-			DEBUG("Creating POSIX thread failed: %d\n", ret);
+			ERROR("Creating POSIX thread failed: %d\n", ret);
 		} else {
 			DEBUG("Thread %lu created", ptids[pthread_count]);
 			pthread_count++;
@@ -2511,11 +2499,11 @@
 			apr_pool_note_subprocess(config->pool, config->forkproc, APR_KILL_AFTER_TIMEOUT);
 			break;
 		default:
-			DEBUG("apr_proc_fork() failed");
+			ERROR("apr_proc_fork() failed");
 			break;
 		}
 	} else {
-		DEBUG("mod_netconf misses configuration structure");
+		ERROR("mod_netconf misses configuration structure");
 	}
 
 	return OK;
