diff --git a/src/Makefile.in b/src/Makefile.in
index b3c983d..463ae55 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -34,7 +34,7 @@
      notification_module.h \
      mod_netconf.h
 
-all: module client
+all: module client webgui-backend
 
 module: mod_netconf.c
 	$(APXS) $(LIBS) $(ARCSID) $(CFLAGS) -c mod_netconf.c notification-server.c
@@ -59,7 +59,7 @@
 
 .PHONY: clean
 clean:
-	rm -rf .libs *.la *.lo *.slo test-client
+	rm -rf .libs *.la *.lo *.slo test-client webgui-backend
 
 .PHONY: tarball
 tarball: $(SRCS) $(HEADERS)
@@ -85,3 +85,6 @@
 .PHONY: distclean
 distclean:
 	rm -rf $(RPMDIR)
+
+webgui-backend: mod_netconf.c notification-server.c mod_netconf.h
+	gcc -Wall -g $(CFLAGS) -DHTTPD_INDEPENDENT  $(RCSID) `apr-1-config  --cflags --cppflags --includes --link-ld` -I/usr/include/httpd $(LIBS) -laprutil-1 -o $@ mod_netconf.c notification-server.c
diff --git a/src/configure b/src/configure
index 2b1a925..db9318f 100755
--- a/src/configure
+++ b/src/configure
@@ -1978,7 +1978,7 @@
 
 
 
-RELEASE=2
+RELEASE=1
 
 LIBS="-lnetconf -ljson"
 
diff --git a/src/configure.in b/src/configure.in
index e965e12..139d0ed 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -17,7 +17,7 @@
 AC_SUBST(USERNAME)
 AC_SUBST(USERMAIL)
 
-RELEASE=2
+RELEASE=1
 AC_SUBST(RELEASE)
 LIBS="-lnetconf -ljson"
 
diff --git a/src/mod_netconf.c b/src/mod_netconf.c
index 318cdce..6def968 100644
--- a/src/mod_netconf.c
+++ b/src/mod_netconf.c
@@ -43,7 +43,9 @@
  * if advised of the possibility of such damage.
  *
  */
+#ifdef ARCSID
 static const char rcsid[] __attribute__((used)) ="$Id: "__FILE__": "ARCSID" $";
+#endif
 
 #include <unistd.h>
 #include <poll.h>
@@ -91,6 +93,8 @@
 #define offsetof(type, member) ((size_t) ((type *) 0)->member)
 #endif
 
+server_rec *http_server = NULL;
+
 /* timeout in msec */
 struct timeval timeout = { 1, 0 };
 
@@ -108,10 +112,10 @@
 
 pthread_rwlock_t session_lock; /**< mutex protecting netconf_sessions_list from multiple access errors */
 pthread_mutex_t ntf_history_lock; /**< mutex protecting notification history list */
+pthread_mutex_t ntf_hist_clbc_mutex; /**< mutex protecting notification history list */
 apr_hash_t *netconf_sessions_list = NULL;
 
 static pthread_key_t notif_history_key;
-server_rec *http_server = NULL;
 
 volatile int isterminated = 0;
 
@@ -120,6 +124,7 @@
 static void signal_handler(int sign)
 {
 	switch (sign) {
+	case SIGINT:
 	case SIGTERM:
 		isterminated = 1;
 		break;
@@ -197,6 +202,10 @@
 		const char* ns,
 		const char* sid)
 {
+	if (err_reply != NULL) {
+		json_object_put(err_reply);
+		err_reply = NULL;
+	}
 	err_reply = json_object_new_object();
 	json_object_object_add(err_reply, "type", json_object_new_int(REPLY_ERROR));
 	if (tag) json_object_object_add(err_reply, "error-tag", json_object_new_string(tag));
@@ -214,35 +223,38 @@
 /**
  * should be used in locked area
  */
-void prepare_status_message(server_rec* server, struct session_with_mutex *s, struct nc_session *session)
+void prepare_status_message(struct session_with_mutex *s, struct nc_session *session)
 {
 	json_object *json_obj = NULL;
-	//json_object *old_sid = NULL;
+	char *old_sid = NULL;
+	const char *j_old_sid = NULL;
 	const char *cpbltstr;
 	struct nc_cpblts* cpblts = NULL;
 
 	if (s == NULL) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "No session given.");
+		DEBUG("No session given.");
 		return;
 	}
 
 	if (s->hello_message != NULL) {
-		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "clean previous hello message");
+		DEBUG("clean previous hello message");
 		//json_object_put(s->hello_message);
+		j_old_sid = json_object_get_string(json_object_object_get(s->hello_message, "sid"));
+		if (j_old_sid != NULL) {
+			old_sid = strdup(j_old_sid);
+		}
 		s->hello_message = NULL;
-
-		//old_sid = json_object_object_get(s->hello_message, "sid");
 	}
 	s->hello_message = json_object_new_object();
 	if (session != NULL) {
-		/** \todo reload hello - save old sid */
-		//if (old_sid != NULL) {
-		//	/* use previous sid */
-		//	json_object_object_add(s->hello_message, "sid", old_sid);
-		//} else {
+		if (old_sid != NULL) {
+			/* use previous sid */
+			json_object_object_add(s->hello_message, "sid", json_object_new_string(old_sid));
+			free(old_sid);
+		} else {
 			/* we don't have old sid */
-		json_object_object_add(s->hello_message, "sid", json_object_new_string(nc_session_get_id(session)));
-		//}
+			json_object_object_add(s->hello_message, "sid", json_object_new_string(nc_session_get_id(session)));
+		}
 		json_object_object_add(s->hello_message, "version", json_object_new_string((nc_session_get_version(session) == 0)?"1.0":"1.1"));
 		json_object_object_add(s->hello_message, "host", json_object_new_string(nc_session_get_host(session)));
 		json_object_object_add(s->hello_message, "port", json_object_new_string(nc_session_get_port(session)));
@@ -256,13 +268,13 @@
 			}
 			json_object_object_add(s->hello_message, "capabilities", json_obj);
 		}
-		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "%s", json_object_to_json_string(s->hello_message));
+		DEBUG("%s", json_object_to_json_string(s->hello_message));
 	} else {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Session was not given.");
+		DEBUG("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."));
 	}
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Status info from hello message prepared");
+	DEBUG("Status info from hello message prepared");
 
 }
 
@@ -278,7 +290,7 @@
  *
  * \warning Session_key hash is not bound with caller identification. This could be potential security risk.
  */
-static char* netconf_connect(server_rec* server, apr_pool_t* pool, const char* host, const char* port, const char* user, const char* pass, struct nc_cpblts * cpblts)
+static char* netconf_connect(apr_pool_t* pool, const char* host, const char* port, const char* user, const char* pass, struct nc_cpblts * cpblts)
 {
 	struct nc_session* session = NULL;
 	struct session_with_mutex * locked_session;
@@ -286,10 +298,10 @@
 
 	/* connect to the requested NETCONF server */
 	password = (char*)pass;
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "prepare to connect %s@%s:%s", user, host, port);
+	DEBUG("prepare to connect %s@%s:%s", user, host, port);
 	nc_verbosity(NC_VERB_DEBUG);
 	session = nc_session_connect(host, (unsigned short) atoi (port), user, cpblts);
-	ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "nc_session_connect done");
+	DEBUG("nc_session_connect done");
 
 	/* if connected successful, add session to the list */
 	if (session != NULL) {
@@ -303,7 +315,7 @@
 		if ((locked_session = malloc (sizeof (struct session_with_mutex))) == NULL || pthread_mutex_init (&locked_session->lock, NULL) != 0) {
 			nc_session_free(session);
 			free (locked_session);
-			ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Creating structure session_with_mutex failed %d (%s)", errno, strerror(errno));
+			DEBUG("Creating structure session_with_mutex failed %d (%s)", errno, strerror(errno));
 			return NULL;
 		}
 		locked_session->session = session;
@@ -311,59 +323,65 @@
 		locked_session->hello_message = NULL;
 		locked_session->closed = 0;
 		pthread_mutex_init (&locked_session->lock, NULL);
-		ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, server, "Before session_lock");
+		DEBUG("Before session_lock");
 		/* get exclusive access to sessions_list (conns) */
+		DEBUG("LOCK wrlock %s", __func__);
 		if (pthread_rwlock_wrlock (&session_lock) != 0) {
 			nc_session_free(session);
 			free (locked_session);
-			ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, server, "Error while locking rwlock: %d (%s)", errno, strerror(errno));
+			DEBUG("Error while locking rwlock: %d (%s)", errno, strerror(errno));
 			return NULL;
 		}
 		locked_session->notifications = apr_array_make(pool, NOTIFICATION_QUEUE_SIZE, sizeof(notification_t));
 		locked_session->ntfc_subscribed = 0;
-		ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, server, "Add connection to the list");
+		DEBUG("Add connection to the list");
 		apr_hash_set(netconf_sessions_list, apr_pstrdup(pool, session_key), APR_HASH_KEY_STRING, (void *) locked_session);
-		ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, server, "Before session_unlock");
+		DEBUG("Before session_unlock");
 
 		/* lock session */
+		DEBUG("LOCK mutex %s", __func__);
 		pthread_mutex_lock(&locked_session->lock);
 
 		/* unlock session list */
+		DEBUG("UNLOCK wrlock %s", __func__);
 		if (pthread_rwlock_unlock (&session_lock) != 0) {
-			ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, server, "Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+			DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 		}
 
 		/* store information about session from hello message for future usage */
-		prepare_status_message(server, locked_session, session);
+		prepare_status_message(locked_session, session);
 
+		DEBUG("UNLOCK mutex %s", __func__);
 		pthread_mutex_unlock(&locked_session->lock);
 
-		ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, server, "NETCONF session established");
+		DEBUG("NETCONF session established");
 		return (session_key);
 	} else {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Connection could not be established");
+		DEBUG("Connection could not be established");
 		return (NULL);
 	}
 
 }
 
-static int close_and_free_session(server_rec *server, struct session_with_mutex *locked_session)
+static int close_and_free_session(struct session_with_mutex *locked_session)
 {
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "lock private lock.");
+	DEBUG("lock private lock.");
+	DEBUG("LOCK mutex %s", __func__);
 	if (pthread_mutex_lock(&locked_session->lock) != 0) {
-		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Error while locking rwlock");
+		DEBUG("Error while locking rwlock");
 	}
 	locked_session->ntfc_subscribed = 0;
 	locked_session->closed = 1;
 	nc_session_free(locked_session->session);
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "session closed.");
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "unlock private lock.");
+	DEBUG("session closed.");
+	DEBUG("unlock private lock.");
+	DEBUG("UNLOCK mutex %s", __func__);
 	if (pthread_mutex_unlock(&locked_session->lock) != 0) {
-		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Error while locking rwlock");
+		DEBUG("Error while locking rwlock");
 	}
 
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "unlock session lock.");
-	ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, server, "closed session, disabled notif(?), wait 2s");
+	DEBUG("unlock session lock.");
+	DEBUG("closed session, disabled notif(?), wait 2s");
 	usleep(500000); /* let notification thread stop */
 
 	/* session shouldn't be used by now */
@@ -378,20 +396,22 @@
 	locked_session->session = NULL;
 	free(locked_session);
 	locked_session = NULL;
-	ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, server, "NETCONF session closed, everything cleared.");
+	DEBUG("NETCONF session closed, everything cleared.");
 	return (EXIT_SUCCESS);
 }
 
-static int netconf_close(server_rec* server, const char* session_key)
+static int netconf_close(const char* session_key, json_object **reply)
 {
 	struct session_with_mutex * locked_session;
 
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Key in hash to close: %s", session_key);
+	DEBUG("Key in hash to close: %s", session_key);
 
 	/* get exclusive (write) access to sessions_list (conns) */
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "lock session lock.");
+	DEBUG("lock session lock.");
+	DEBUG("LOCK wrlock %s", __func__);
 	if (pthread_rwlock_wrlock (&session_lock) != 0) {
-		ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, server, "Error while locking rwlock");
+		DEBUG("Error while locking rwlock");
+		(*reply) = create_error("Internal: Error while locking.");
 		return EXIT_FAILURE;
 	}
 	/* get session to close */
@@ -399,84 +419,106 @@
 	/* remove session from the active sessions list -> nobody new can now work with session */
 	apr_hash_set(netconf_sessions_list, session_key, APR_HASH_KEY_STRING, NULL);
 
+	DEBUG("UNLOCK wrlock %s", __func__);
 	if (pthread_rwlock_unlock (&session_lock) != 0) {
-		ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, server, "Error while unlocking rwlock");
+		DEBUG("Error while unlocking rwlock");
+		(*reply) = create_error("Internal: Error while unlocking.");
 	}
 
 	if ((locked_session != NULL) && (locked_session->session != NULL)) {
-		return close_and_free_session(server, locked_session);
+		return close_and_free_session(locked_session);
 	} else {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Unknown session to close");
+		DEBUG("Unknown session to close");
+		(*reply) = create_error("Internal: Unkown session to close.");
 		return (EXIT_FAILURE);
 	}
+	(*reply) = NULL;
 }
 
 /**
  * Test reply message type and return error message.
  *
- * \param[in] server	httpd server for logging
  * \param[in] session	nc_session internal struct
  * \param[in] session_key session key, NULL to disable disconnect on error
  * \param[in] msgt	RPC-REPLY message type
  * \param[out] data
  * \return NULL on success
  */
-json_object *netconf_test_reply(server_rec *server, struct nc_session *session, const char *session_key, NC_MSG_TYPE msgt, nc_reply *reply, char **data)
+json_object *netconf_test_reply(struct nc_session *session, const char *session_key, NC_MSG_TYPE msgt, nc_reply *reply, char **data)
 {
 	NC_REPLY_TYPE replyt;
+	json_object *err = NULL;
 
 	/* process the result of the operation */
 	switch (msgt) {
 		case NC_MSG_UNKNOWN:
 			if (nc_session_get_status(session) != NC_SESSION_STATUS_WORKING) {
-				ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "mod_netconf: receiving rpc-reply failed");
+				DEBUG("mod_netconf: receiving rpc-reply failed");
 				if (session_key != NULL) {
-					netconf_close(server, session_key);
+					netconf_close(session_key, &err);
+				}
+				if (err != NULL) {
+					return err;
 				}
 				return create_error("Internal: Receiving RPC-REPLY failed.");
 			}
 		case NC_MSG_NONE:
 			/* there is error handled by callback */
+			if (data != NULL) {
+				free(*data);
+			}
 			(*data) = NULL;
 			return NULL;
 		case NC_MSG_REPLY:
 			switch (replyt = nc_reply_get_type(reply)) {
 				case NC_REPLY_OK:
-					(*data) = NULL;
-					return NULL;
+					if ((data != NULL) && (*data != NULL)) {
+						free(*data);
+						(*data) = NULL;
+					}
+					return create_ok();
 				case NC_REPLY_DATA:
-					if (((*data) = nc_reply_get_data (reply)) == NULL) {
-						ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "mod_netconf: no data from reply");
+					if (((*data) = nc_reply_get_data(reply)) == NULL) {
+						DEBUG("mod_netconf: no data from reply");
 						return create_error("Internal: No data from reply received.");
 					} else {
 						return NULL;
 					}
 					break;
 				case NC_REPLY_ERROR:
-					ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "mod_netconf: unexpected rpc-reply (%d)", replyt);
-					(*data) = NULL;
+					DEBUG("mod_netconf: unexpected rpc-reply (%d)", replyt);
+					if (data != NULL) {
+						free(*data);
+						(*data) = NULL;
+					}
 					return create_error(nc_reply_get_errormsg(reply));
 				default:
-					ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "mod_netconf: unexpected rpc-reply (%d)", replyt);
-					(*data) = NULL;
+					DEBUG("mod_netconf: unexpected rpc-reply (%d)", replyt);
+					if (data != NULL) {
+						free(*data);
+						(*data) = NULL;
+					}
 					return create_error(nc_reply_get_errormsg(reply));
 			}
 			break;
 		default:
-			ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "mod_netconf: unexpected reply message received (%d)", msgt);
-			(*data) = NULL;
+			DEBUG("mod_netconf: unexpected reply message received (%d)", msgt);
+			if (data != NULL) {
+				free(*data);
+				(*data) = NULL;
+			}
 			return create_error("Internal: Unexpected RPC-REPLY message type.");
 	}
 }
 
-json_object *netconf_unlocked_op(server_rec* server, struct nc_session *session, nc_rpc* rpc)
+json_object *netconf_unlocked_op(struct nc_session *session, nc_rpc* rpc)
 {
 	nc_reply* reply = NULL;
 	NC_MSG_TYPE msgt;
 
 	/* check requests */
 	if (rpc == NULL) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "mod_netconf: rpc is not created");
+		DEBUG("mod_netconf: rpc is not created");
 		return create_error("Internal error: RPC is not created");
 	}
 
@@ -484,9 +526,9 @@
 		/* send the request and get the reply */
 		msgt = nc_session_send_recv(session, rpc, &reply);
 		/* process the result of the operation */
-		return netconf_test_reply(server, session, NULL, msgt, reply, NULL);
+		return netconf_test_reply(session, NULL, msgt, reply, NULL);
 	} else {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Unknown session to process.");
+		DEBUG("Unknown session to process.");
 		return create_error("Internal error: Unknown session to process.");
 	}
 }
@@ -494,32 +536,32 @@
 /**
  * Perform RPC method that returns data.
  *
- * \param[in] server	httpd server
  * \param[in] session_key	session identifier
  * \param[in] rpc	RPC message to perform
  * \param[out] received_data	received data string, can be NULL when no data expected, value can be set to NULL if no data received
  * \return NULL on success, json object with error otherwise
  */
-static json_object *netconf_op(server_rec* server, const char* session_key, nc_rpc* rpc, char **received_data)
+static json_object *netconf_op(const char* session_key, nc_rpc* rpc, char **received_data)
 {
 	struct nc_session *session = NULL;
 	struct session_with_mutex * locked_session;
 	nc_reply* reply = NULL;
 	json_object *res = NULL;
-	char* data;
+	char *data = NULL;
 	NC_MSG_TYPE msgt;
 
 	/* check requests */
 	if (rpc == NULL) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "mod_netconf: rpc is not created");
+		DEBUG("mod_netconf: rpc is not created");
 		res = create_error("Internal: RPC could not be created.");
 		data = NULL;
 		goto finished;
 	}
 
 	/* get non-exclusive (read) access to sessions_list (conns) */
+	DEBUG("LOCK wrlock %s", __func__);
 	if (pthread_rwlock_rdlock (&session_lock) != 0) {
-		ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, server, "Error while locking rwlock: %d (%s)", errno, strerror(errno));
+		DEBUG("Error while locking rwlock: %d (%s)", errno, strerror(errno));
 		res = create_error("Internal: Lock failed.");
 		data = NULL;
 		goto finished;
@@ -531,19 +573,22 @@
 	}
 	if (session != NULL) {
 		/* get exclusive access to session */
+		DEBUG("LOCK mutex %s", __func__);
 		if (pthread_mutex_lock(&locked_session->lock) != 0) {
 			/* unlock before returning error */
+			DEBUG("UNLOCK wrlock %s", __func__);
 			if (pthread_rwlock_unlock (&session_lock) != 0) {
 
-				ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, server, "Error while locking rwlock: %d (%s)", errno, strerror(errno));
+				DEBUG("Error while locking rwlock: %d (%s)", errno, strerror(errno));
 				res = create_error("Internal: Could not unlock.");
 				goto finished;
 			}
 			res = create_error("Internal: Could not unlock.");
 		}
+		DEBUG("UNLOCK wrlock %s", __func__);
 		if (pthread_rwlock_unlock(&session_lock) != 0) {
 
-			ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, server, "Error while locking rwlock: %d (%s)", errno, strerror(errno));
+			DEBUG("Error while locking rwlock: %d (%s)", errno, strerror(errno));
 			res = create_error("Internal: Could not unlock.");
 		}
 
@@ -553,16 +598,18 @@
 		msgt = nc_session_send_recv(session, rpc, &reply);
 
 		/* first release exclusive lock for this session */
+		DEBUG("UNLOCK mutex %s", __func__);
 		pthread_mutex_unlock(&locked_session->lock);
 		/* end of critical section */
 
-		res = netconf_test_reply(server, session, session_key, msgt, reply, &data);
+		res = netconf_test_reply(session, session_key, msgt, reply, &data);
 	} else {
 		/* release lock on failure */
+		DEBUG("UNLOCK wrlock %s", __func__);
 		if (pthread_rwlock_unlock (&session_lock) != 0) {
-			ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, server, "Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+			DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 		}
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Unknown session to process.");
+		DEBUG("Unknown session to process.");
 		res = create_error("Unknown session to process.");
 		data = NULL;
 	}
@@ -570,11 +617,16 @@
 	nc_reply_free(reply);
 	if (received_data != NULL) {
 		(*received_data) = data;
+	} else {
+		if (data != NULL) {
+			free(data);
+			data = NULL;
+		}
 	}
 	return res;
 }
 
-static char* netconf_getconfig(server_rec* server, const char* session_key, NC_DATASTORE source, const char* filter)
+static char* netconf_getconfig(const char* session_key, NC_DATASTORE source, const char* filter, json_object **err)
 {
 	nc_rpc* rpc;
 	struct nc_filter *f = NULL;
@@ -590,25 +642,27 @@
 	rpc = nc_rpc_getconfig (source, f);
 	nc_filter_free(f);
 	if (rpc == NULL) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "mod_netconf: creating rpc request failed");
+		DEBUG("mod_netconf: creating rpc request failed");
 		return (NULL);
 	}
 
 	/* tell server to show all elements even if they have default values */
 	if (nc_rpc_capability_attr(rpc, NC_CAP_ATTR_WITHDEFAULTS_MODE, NCWD_MODE_ALL)) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "mod_netconf: setting withdefaults failed");
+		DEBUG("mod_netconf: setting withdefaults failed");
 	}
 
-	res = netconf_op(server, session_key, rpc, &data);
+	res = netconf_op(session_key, rpc, &data);
 	nc_rpc_free (rpc);
-	if (res == NULL) {
-		/* TODO return error message somehow */
+	if (res != NULL) {
+		(*err) = res;
+	} else {
+		(*err) = NULL;
 	}
 
 	return (data);
 }
 
-static char* netconf_getschema(server_rec* server, const char* session_key, const char* identifier, const char* version, const char* format)
+static char* netconf_getschema(const char* session_key, const char* identifier, const char* version, const char* format, json_object **err)
 {
 	nc_rpc* rpc;
 	char* data = NULL;
@@ -617,20 +671,22 @@
 	/* create requests */
 	rpc = nc_rpc_getschema(identifier, version, format);
 	if (rpc == NULL) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "mod_netconf: creating rpc request failed");
+		DEBUG("mod_netconf: creating rpc request failed");
 		return (NULL);
 	}
 
-	res = netconf_op(server, session_key, rpc, &data);
+	res = netconf_op(session_key, rpc, &data);
 	nc_rpc_free (rpc);
-	if (res == NULL) {
-		/* TODO return error message somehow */
+	if (res != NULL) {
+		(*err) = res;
+	} else {
+		(*err) = NULL;
 	}
 
 	return (data);
 }
 
-static char* netconf_get(server_rec* server, const char* session_key, const char* filter)
+static char* netconf_get(const char* session_key, const char* filter, json_object **err)
 {
 	nc_rpc* rpc;
 	struct nc_filter *f = NULL;
@@ -646,25 +702,27 @@
 	rpc = nc_rpc_get (f);
 	nc_filter_free(f);
 	if (rpc == NULL) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "mod_netconf: creating rpc request failed");
+		DEBUG("mod_netconf: creating rpc request failed");
 		return (NULL);
 	}
 
 	/* tell server to show all elements even if they have default values */
 	if (nc_rpc_capability_attr(rpc, NC_CAP_ATTR_WITHDEFAULTS_MODE, NCWD_MODE_ALL)) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "mod_netconf: setting withdefaults failed");
+		DEBUG("mod_netconf: setting withdefaults failed");
 	}
 
-	res = netconf_op(server, session_key, rpc, &data);
+	res = netconf_op(session_key, rpc, &data);
 	nc_rpc_free (rpc);
 	if (res == NULL) {
-		/* TODO return error message somehow */
+		(*err) = res;
+	} else {
+		(*err) = NULL;
 	}
 
 	return (data);
 }
 
-static json_object *netconf_copyconfig(server_rec* server, const char* session_key, NC_DATASTORE source, NC_DATASTORE target, const char* config, const char *url)
+static json_object *netconf_copyconfig(const char* session_key, NC_DATASTORE source, NC_DATASTORE target, const char* config, const char *url)
 {
 	nc_rpc* rpc;
 	json_object *res = NULL;
@@ -684,17 +742,17 @@
 		}
 	}
 	if (rpc == NULL) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "mod_netconf: creating rpc request failed");
+		DEBUG("mod_netconf: creating rpc request failed");
 		return create_error("Internal: Creating rpc request failed");
 	}
 
-	res = netconf_op(server, session_key, rpc, NULL);
+	res = netconf_op(session_key, rpc, NULL);
 	nc_rpc_free (rpc);
 
 	return res;
 }
 
-static json_object *netconf_editconfig(server_rec* server, const char* session_key, NC_DATASTORE target, NC_EDIT_DEFOP_TYPE defop, NC_EDIT_ERROPT_TYPE erropt, NC_EDIT_TESTOPT_TYPE testopt, const char* config)
+static json_object *netconf_editconfig(const char* session_key, NC_DATASTORE target, NC_EDIT_DEFOP_TYPE defop, NC_EDIT_ERROPT_TYPE erropt, NC_EDIT_TESTOPT_TYPE testopt, const char* config)
 {
 	nc_rpc* rpc;
 	json_object *res = NULL;
@@ -703,17 +761,17 @@
 	/* TODO source NC_DATASTORE_CONFIG / NC_DATASTORE_URL  */
 	rpc = nc_rpc_editconfig(target, NC_DATASTORE_CONFIG, defop, erropt, testopt, config);
 	if (rpc == NULL) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "mod_netconf: creating rpc request failed");
+		DEBUG("mod_netconf: creating rpc request failed");
 		return create_error("Internal: Creating rpc request failed");
 	}
 
-	res = netconf_op(server, session_key, rpc, NULL);
+	res = netconf_op(session_key, rpc, NULL);
 	nc_rpc_free (rpc);
 
 	return res;
 }
 
-static json_object *netconf_killsession(server_rec* server, const char* session_key, const char* sid)
+static json_object *netconf_killsession(const char* session_key, const char* sid)
 {
 	nc_rpc* rpc;
 	json_object *res = NULL;
@@ -721,16 +779,16 @@
 	/* create requests */
 	rpc = nc_rpc_killsession(sid);
 	if (rpc == NULL) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "mod_netconf: creating rpc request failed");
+		DEBUG("mod_netconf: creating rpc request failed");
 		return create_error("Internal: Creating rpc request failed");
 	}
 
-	res = netconf_op(server, session_key, rpc, NULL);
+	res = netconf_op(session_key, rpc, NULL);
 	nc_rpc_free (rpc);
 	return res;
 }
 
-static json_object *netconf_onlytargetop(server_rec* server, const char* session_key, NC_DATASTORE target, nc_rpc* (*op_func)(NC_DATASTORE))
+static json_object *netconf_onlytargetop(const char* session_key, NC_DATASTORE target, nc_rpc* (*op_func)(NC_DATASTORE))
 {
 	nc_rpc* rpc;
 	json_object *res = NULL;
@@ -738,16 +796,16 @@
 	/* create requests */
 	rpc = op_func(target);
 	if (rpc == NULL) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "mod_netconf: creating rpc request failed");
+		DEBUG("mod_netconf: creating rpc request failed");
 		return create_error("Internal: Creating rpc request failed");
 	}
 
-	res = netconf_op(server, session_key, rpc, NULL);
+	res = netconf_op(session_key, rpc, NULL);
 	nc_rpc_free (rpc);
 	return res;
 }
 
-static json_object *netconf_deleteconfig(server_rec* server, const char* session_key, NC_DATASTORE target, const char *url)
+static json_object *netconf_deleteconfig(const char* session_key, NC_DATASTORE target, const char *url)
 {
 	nc_rpc *rpc = NULL;
 	json_object *res = NULL;
@@ -757,26 +815,26 @@
 		rpc = nc_rpc_deleteconfig(target, url);
 	}
 	if (rpc == NULL) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "mod_netconf: creating rpc request failed");
+		DEBUG("mod_netconf: creating rpc request failed");
 		return create_error("Internal: Creating rpc request failed");
 	}
 
-	res = netconf_op(server, session_key, rpc, NULL);
+	res = netconf_op(session_key, rpc, NULL);
 	nc_rpc_free (rpc);
 	return res;
 }
 
-static json_object *netconf_lock(server_rec* server, const char* session_key, NC_DATASTORE target)
+static json_object *netconf_lock(const char* session_key, NC_DATASTORE target)
 {
-	return (netconf_onlytargetop(server, session_key, target, nc_rpc_lock));
+	return (netconf_onlytargetop(session_key, target, nc_rpc_lock));
 }
 
-static json_object *netconf_unlock(server_rec* server, const char* session_key, NC_DATASTORE target)
+static json_object *netconf_unlock(const char* session_key, NC_DATASTORE target)
 {
-	return (netconf_onlytargetop(server, session_key, target, nc_rpc_unlock));
+	return (netconf_onlytargetop(session_key, target, nc_rpc_unlock));
 }
 
-static json_object *netconf_generic(server_rec* server, const char* session_key, const char* content, char** data)
+static json_object *netconf_generic(const char* session_key, const char* content, char** data)
 {
 	nc_rpc* rpc = NULL;
 	json_object *res = NULL;
@@ -784,7 +842,7 @@
 	/* create requests */
 	rpc = nc_rpc_generic(content);
 	if (rpc == NULL) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "mod_netconf: creating rpc request failed");
+		DEBUG("mod_netconf: creating rpc request failed");
 		return create_error("Internal: Creating rpc request failed");
 	}
 
@@ -794,7 +852,7 @@
 	}
 
 	/* get session where send the RPC */
-	res = netconf_op(server, session_key, rpc, data);
+	res = netconf_op(session_key, rpc, data);
 	nc_rpc_free (rpc);
 	return res;
 }
@@ -803,21 +861,20 @@
  * @}
  *//* netconf_operations */
 
-server_rec* clb_print_server;
 void clb_print(NC_VERB_LEVEL level, const char* msg)
 {
 	switch (level) {
 	case NC_VERB_ERROR:
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, clb_print_server, "%s", msg);
+		DEBUG("%s", msg);
 		break;
 	case NC_VERB_WARNING:
-		ap_log_error(APLOG_MARK, APLOG_WARNING, 0, clb_print_server, "%s", msg);
+		DEBUG("%s", msg);
 		break;
 	case NC_VERB_VERBOSE:
-		ap_log_error(APLOG_MARK, APLOG_INFO, 0, clb_print_server, "%s", msg);
+		DEBUG("%s", msg);
 		break;
 	case NC_VERB_DEBUG:
-		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, clb_print_server, "%s", msg);
+		DEBUG("%s", msg);
 		break;
 	}
 }
@@ -826,10 +883,9 @@
  * Receive message from client over UNIX socket and return pointer to it.
  * Caller should free message memory.
  * \param[in] client	socket descriptor of client
- * \param[in] server	httpd server for logging
  * \return pointer to message
  */
-char *get_framed_message(server_rec *server, int client)
+char *get_framed_message(int client)
 {
 	/* read json in chunked framing */
 	unsigned int buffer_size = 0;
@@ -872,7 +928,7 @@
 			}
 			chunk_len_str[i++] = c;
 			if (i==11) {
-				ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Message is too long, buffer for length is not big enought!!!!");
+				DEBUG("Message is too long, buffer for length is not big enought!!!!");
 				break;
 			}
 		}
@@ -893,6 +949,7 @@
 		}
 		buffer_size += chunk_len+1;
 		buffer = realloc (buffer, sizeof(char)*buffer_size);
+		memset(buffer + (buffer_size-chunk_len-1), 0, chunk_len+1);
 		if ((ret = recv (client, buffer+buffer_len, chunk_len, 0)) == -1 || ret != chunk_len) {
 			if (buffer != NULL) {
 				free (buffer);
@@ -923,8 +980,10 @@
 json_object *create_error(const char *errmess)
 {
 	json_object *reply = json_object_new_object();
+	json_object *array = json_object_new_array();
 	json_object_object_add(reply, "type", json_object_new_int(REPLY_ERROR));
-	json_object_object_add(reply, "error-message", json_object_new_string(errmess));
+	json_object_array_add(array, json_object_new_string(errmess));
+	json_object_object_add(reply, "errors", array);
 	return reply;
 
 }
@@ -937,7 +996,15 @@
 	return reply;
 }
 
-json_object *handle_op_connect(server_rec *server, apr_pool_t *pool, json_object *request)
+json_object *create_ok()
+{
+	json_object *reply = json_object_new_object();
+	reply = json_object_new_object();
+	json_object_object_add(reply, "type", json_object_new_int(REPLY_OK));
+	return reply;
+}
+
+json_object *handle_op_connect(apr_pool_t *pool, json_object *request)
 {
 	const char *host = NULL;
 	const char *port = NULL;
@@ -949,7 +1016,7 @@
 	struct nc_cpblts* cpblts = NULL;
 	unsigned int len, i;
 
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Request: Connect");
+	DEBUG("Request: Connect");
 	host = json_object_get_string(json_object_object_get((json_object *) request, "host"));
 	port = json_object_get_string(json_object_object_get((json_object *) request, "port"));
 	user = json_object_get_string(json_object_object_get((json_object *) request, "user"));
@@ -962,16 +1029,16 @@
 			nc_cpblts_add(cpblts, json_object_get_string(json_object_array_get_idx(capabilities, i)));
 		}
 	} else {
-		ap_log_error (APLOG_MARK, APLOG_ERR, 0, server, "no capabilities specified");
+		DEBUG("no capabilities specified");
 	}
 
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "host: %s, port: %s, user: %s", host, port, user);
+	DEBUG("host: %s, port: %s, user: %s", host, port, user);
 	if ((host == NULL) || (user == NULL)) {
-		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Cannot connect - insufficient input.");
+		DEBUG("Cannot connect - insufficient input.");
 		session_key_hash = NULL;
 	} else {
-		session_key_hash = netconf_connect(server, pool, host, port, user, pass, cpblts);
-		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "hash: %s", session_key_hash);
+		session_key_hash = netconf_connect(pool, host, port, user, pass, cpblts);
+		DEBUG("hash: %s", session_key_hash);
 	}
 	if (cpblts != NULL) {
 		nc_cpblts_free(cpblts);
@@ -983,11 +1050,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."));
-			ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Connection failed.");
+			DEBUG("Connection failed.");
 		} else {
 			/* use filled err_reply from libnetconf's callback */
 			reply = err_reply;
-			ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Connect - error from libnetconf's callback.");
+			DEBUG("Connect - error from libnetconf's callback.");
 		}
 	} else {
 		/* positive reply */
@@ -1000,40 +1067,43 @@
 	return reply;
 }
 
-json_object *handle_op_get(server_rec *server, apr_pool_t *pool, json_object *request, const char *session_key)
+json_object *handle_op_get(apr_pool_t *pool, json_object *request, const char *session_key)
 {
 	const char *filter = NULL;
-	const char *data = NULL;
+	char *data = NULL;
 	json_object *reply = NULL;
 
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Request: get (session %s)", session_key);
+	DEBUG("Request: get (session %s)", session_key);
 
 	filter = json_object_get_string(json_object_object_get(request, "filter"));
 
-	if ((data = netconf_get(server, session_key, filter)) == NULL) {
-		if (err_reply == NULL) {
-			reply = create_error("Get information from device failed.");
-		} else {
-			/* use filled err_reply from libnetconf's callback */
-			reply = err_reply;
+	if ((data = netconf_get(session_key, filter, &reply)) == NULL) {
+		if (reply == NULL) {
+			if (err_reply == NULL) {
+				reply = create_error("Get information failed.");
+			} else {
+				/* use filled err_reply from libnetconf's callback */
+				reply = err_reply;
+			}
 		}
 	} else {
-		return create_data(data);
+		reply = create_data(data);
+		free(data);
 	}
 	return reply;
 }
 
-json_object *handle_op_getconfig(server_rec *server, apr_pool_t *pool, json_object *request, const char *session_key)
+json_object *handle_op_getconfig(apr_pool_t *pool, json_object *request, const char *session_key)
 {
 	NC_DATASTORE ds_type_s = -1;
 	NC_DATASTORE ds_type_t = -1;
 	const char *filter = NULL;
-	const char *data = NULL;
+	char *data = NULL;
 	const char *source = NULL;
 	const char *target = NULL;
 	json_object *reply = NULL;
 
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Request: get-config (session %s)", session_key);
+	DEBUG("Request: get-config (session %s)", session_key);
 
 	filter = json_object_get_string(json_object_object_get(request, "filter"));
 
@@ -1048,28 +1118,31 @@
 		return create_error("Invalid source repository type requested.");
 	}
 
-	if ((data = netconf_getconfig(server, session_key, ds_type_s, filter)) == NULL) {
-		if (err_reply == NULL) {
-			reply = create_error("Get configuration information from device failed.");
-		} else {
-			/* use filled err_reply from libnetconf's callback */
-			reply = err_reply;
+	if ((data = netconf_getconfig(session_key, ds_type_s, filter, &reply)) == NULL) {
+		if (reply == NULL) {
+			if (err_reply == NULL) {
+				reply = create_error("Get configuration operation failed.");
+			} else {
+				/* use filled err_reply from libnetconf's callback */
+				reply = err_reply;
+			}
 		}
 	} else {
-		return create_data(data);
+		reply = create_data(data);
+		free(data);
 	}
 	return reply;
 }
 
-json_object *handle_op_getschema(server_rec *server, apr_pool_t *pool, json_object *request, const char *session_key)
+json_object *handle_op_getschema(apr_pool_t *pool, json_object *request, const char *session_key)
 {
-	const char *data = NULL;
+	char *data = NULL;
 	const char *identifier = NULL;
 	const char *version = NULL;
 	const char *format = NULL;
 	json_object *reply = NULL;
 
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Request: get-schema (session %s)", session_key);
+	DEBUG("Request: get-schema (session %s)", session_key);
 	identifier = json_object_get_string(json_object_object_get(request, "identifier"));
 	if (identifier == NULL) {
 		return create_error("No identifier for get-schema supplied.");
@@ -1077,21 +1150,24 @@
 	version = json_object_get_string(json_object_object_get(request, "version"));
 	format = json_object_get_string(json_object_object_get(request, "format"));
 
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "get-schema(version: %s, format: %s)", version, format);
-	if ((data = netconf_getschema(server, session_key, identifier, version, format)) == NULL) {
-		if (err_reply == NULL) {
-			reply = create_error("Get schema failed.");
-		} else {
-			/* use filled err_reply from libnetconf's callback */
-			reply = err_reply;
+	DEBUG("get-schema(version: %s, format: %s)", version, format);
+	if ((data = netconf_getschema(session_key, identifier, version, format, &reply)) == NULL) {
+		if (reply == NULL) {
+			if (err_reply == NULL) {
+				reply = create_error("Get models operation failed.");
+			} else {
+				/* use filled err_reply from libnetconf's callback */
+				reply = err_reply;
+			}
 		}
 	} else {
-		return create_data(data);
+		reply = create_data(data);
+		free(data);
 	}
 	return reply;
 }
 
-json_object *handle_op_editconfig(server_rec *server, apr_pool_t *pool, json_object *request, const char *session_key)
+json_object *handle_op_editconfig(apr_pool_t *pool, json_object *request, const char *session_key)
 {
 	NC_DATASTORE ds_type_s = -1;
 	NC_DATASTORE ds_type_t = -1;
@@ -1104,7 +1180,7 @@
 	const char *target = NULL;
 	json_object *reply = NULL;
 
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Request: edit-config (session %s)", session_key);
+	DEBUG("Request: edit-config (session %s)", session_key);
 
 	defop = json_object_get_string(json_object_object_get(request, "default-operation"));
 	if (defop != NULL) {
@@ -1152,21 +1228,17 @@
 		return create_error("Invalid config data parameter.");
 	}
 
-	if (netconf_editconfig(server, session_key, ds_type_t, defop_type, erropt_type, NC_EDIT_TESTOPT_TESTSET, config) != EXIT_SUCCESS) {
-		if (err_reply == NULL) {
-			reply = create_error("Edit-config failed.");
-		} else {
+	reply = netconf_editconfig(session_key, ds_type_t, defop_type, erropt_type, NC_EDIT_TESTOPT_TESTSET, config);
+	if (reply == NULL) {
+		if (err_reply != NULL) {
 			/* use filled err_reply from libnetconf's callback */
 			reply = err_reply;
 		}
-	} else {
-		reply = json_object_new_object();
-		json_object_object_add(reply, "type", json_object_new_int(REPLY_OK));
 	}
 	return reply;
 }
 
-json_object *handle_op_copyconfig(server_rec *server, apr_pool_t *pool, json_object *request, const char *session_key)
+json_object *handle_op_copyconfig(apr_pool_t *pool, json_object *request, const char *session_key)
 {
 	NC_DATASTORE ds_type_s = -1;
 	NC_DATASTORE ds_type_t = -1;
@@ -1175,7 +1247,7 @@
 	const char *source = NULL;
 	json_object *reply = NULL;
 
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Request: copy-config (session %s)", session_key);
+	DEBUG("Request: copy-config (session %s)", session_key);
 
 	/* get parameters */
 	if ((target = json_object_get_string(json_object_object_get(request, "target"))) != NULL) {
@@ -1201,28 +1273,24 @@
 	if (source == NULL && config == NULL) {
 		reply = create_error("invalid input parameters - one of source and config is required.");
 	} else {
-		if (netconf_copyconfig(server, session_key, ds_type_s, ds_type_t, config, "") != EXIT_SUCCESS) {
-			if (err_reply == NULL) {
-				reply = create_error("Copying of configuration failed.");
-			} else {
+		reply = netconf_copyconfig(session_key, ds_type_s, ds_type_t, config, "");
+		if (reply == NULL) {
+			if (err_reply != NULL) {
 				/* use filled err_reply from libnetconf's callback */
 				reply = err_reply;
 			}
-		} else {
-			reply = json_object_new_object();
-			json_object_object_add(reply, "type", json_object_new_int(REPLY_OK));
 		}
 	}
 	return reply;
 }
 
-json_object *handle_op_generic(server_rec *server, apr_pool_t *pool, json_object *request, const char *session_key)
+json_object *handle_op_generic(apr_pool_t *pool, json_object *request, const char *session_key)
 {
 	json_object *reply = NULL;
 	const char *config = NULL;
 	char *data = NULL;
 
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Request: generic request for session %s", session_key);
+	DEBUG("Request: generic request for session %s", session_key);
 
 	config = json_object_get_string(json_object_object_get(request, "content"));
 
@@ -1230,10 +1298,10 @@
 		return create_error("Missing content parameter.");
 	}
 
-	if (netconf_generic(server, session_key, config, &data) != EXIT_SUCCESS) {
-		if (err_reply == NULL) {
-			reply = create_error("Killing of session failed.");
-		} else {
+	/* TODO */
+	reply = netconf_generic(session_key, config, &data);
+	if (reply == NULL) {
+		if (err_reply != NULL) {
 			/* use filled err_reply from libnetconf's callback */
 			reply = err_reply;
 		}
@@ -1242,23 +1310,26 @@
 			reply = json_object_new_object();
 			json_object_object_add(reply, "type", json_object_new_int(REPLY_OK));
 		} else {
-			return create_data(data);
+			reply = create_data(data);
+			free(data);
 		}
 	}
 	return reply;
 }
 
-json_object *handle_op_disconnect(server_rec *server, apr_pool_t *pool, json_object *request, const char *session_key)
+json_object *handle_op_disconnect(apr_pool_t *pool, json_object *request, const char *session_key)
 {
 	json_object *reply = NULL;
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Request: Disconnect session %s", session_key);
+	DEBUG("Request: Disconnect session %s", session_key);
 
-	if (netconf_close(server, session_key) != EXIT_SUCCESS) {
-		if (err_reply == NULL) {
-			reply = create_error("Invalid session identifier.");
-		} else {
-			/* use filled err_reply from libnetconf's callback */
-			reply = err_reply;
+	if (netconf_close(session_key, &reply) != EXIT_SUCCESS) {
+		if (reply == NULL) {
+			if (err_reply == NULL) {
+				reply = create_error("Get configuration information from device failed.");
+			} else {
+				/* use filled err_reply from libnetconf's callback */
+				reply = err_reply;
+			}
 		}
 	} else {
 		reply = json_object_new_object();
@@ -1267,12 +1338,12 @@
 	return reply;
 }
 
-json_object *handle_op_kill(server_rec *server, apr_pool_t *pool, json_object *request, const char *session_key)
+json_object *handle_op_kill(apr_pool_t *pool, json_object *request, const char *session_key)
 {
 	json_object *reply = NULL;
 	const char *sid = NULL;
 
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Request: kill-session, session %s", session_key);
+	DEBUG("Request: kill-session, session %s", session_key);
 
 	sid = json_object_get_string(json_object_object_get(request, "session-id"));
 
@@ -1280,52 +1351,54 @@
 		return create_error("Missing session-id parameter.");
 	}
 
-	if (netconf_killsession(server, session_key, sid) != EXIT_SUCCESS) {
-		if (err_reply == NULL) {
-			reply = create_error("Killing of session failed.");
-		} else {
+	reply = netconf_killsession(session_key, sid);
+	if (reply == NULL) {
+		if (err_reply != NULL) {
 			/* use filled err_reply from libnetconf's callback */
 			reply = err_reply;
 		}
-	} else {
-		reply = json_object_new_object();
-		json_object_object_add(reply, "type", json_object_new_int(REPLY_OK));
 	}
 	return reply;
 }
 
-json_object *handle_op_reloadhello(server_rec *server, apr_pool_t *pool, json_object *request, const char *session_key)
+json_object *handle_op_reloadhello(apr_pool_t *pool, json_object *request, const char *session_key)
 {
 	struct nc_session *temp_session = NULL;
 	struct session_with_mutex * locked_session = NULL;
 	json_object *reply = NULL;
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Request: get info about session %s", session_key);
+	DEBUG("Request: get info about session %s", session_key);
+	return create_ok();
 
+	DEBUG("LOCK wrlock %s", __func__);
 	if (pthread_rwlock_rdlock(&session_lock) != 0) {
-		ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, server, "Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+		DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 		return NULL;
 	}
 
 	locked_session = (struct session_with_mutex *)apr_hash_get(netconf_sessions_list, session_key, APR_HASH_KEY_STRING);
 	if ((locked_session != NULL) && (locked_session->hello_message != NULL)) {
+		DEBUG("LOCK mutex %s", __func__);
 		pthread_mutex_lock(&locked_session->lock);
+		DEBUG("UNLOCK wrlock %s", __func__);
 		if (pthread_rwlock_unlock(&session_lock) != 0) {
-			ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, server, "Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+			DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 		}
-		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "creating temporal NC session.");
+		DEBUG("creating temporal NC session.");
 		temp_session = nc_session_connect_channel(locked_session->session, NULL);
 		if (temp_session != NULL) {
-			prepare_status_message(server, locked_session, temp_session);
-			ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "closing temporal NC session.");
+			prepare_status_message(locked_session, temp_session);
+			DEBUG("closing temporal NC session.");
 			nc_session_free(temp_session);
 		} else {
-			ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Reload hello failed due to channel establishment");
+			DEBUG("Reload hello failed due to channel establishment");
 			reply = create_error("Reload was unsuccessful, connection failed.");
 		}
+		DEBUG("UNLOCK mutex %s", __func__);
 		pthread_mutex_unlock(&locked_session->lock);
 	} else {
+		DEBUG("UNLOCK wrlock %s", __func__);
 		if (pthread_rwlock_unlock(&session_lock) != 0) {
-			ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, server, "Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+			DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 		}
 		reply = create_error("Invalid session identifier.");
 	}
@@ -1336,31 +1409,36 @@
 	return reply;
 }
 
-json_object *handle_op_info(server_rec *server, apr_pool_t *pool, json_object *request, const char *session_key)
+json_object *handle_op_info(apr_pool_t *pool, json_object *request, const char *session_key)
 {
 	json_object *reply = NULL;
 	struct session_with_mutex * locked_session = NULL;
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Request: get info about session %s", session_key);
+	DEBUG("Request: get info about session %s", session_key);
 
+	DEBUG("LOCK wrlock %s", __func__);
 	if (pthread_rwlock_rdlock(&session_lock) != 0) {
-		ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, server, "Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+		DEBUG("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);
 	if (locked_session != NULL) {
+		DEBUG("LOCK mutex %s", __func__);
 		pthread_mutex_lock(&locked_session->lock);
+		DEBUG("UNLOCK wrlock %s", __func__);
 		if (pthread_rwlock_unlock(&session_lock) != 0) {
-			ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, server, "Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+			DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 		}
 		if (locked_session->hello_message != NULL) {
 			reply = locked_session->hello_message;
 		} else {
 			reply = create_error("Invalid session identifier.");
 		}
+		DEBUG("UNLOCK mutex %s", __func__);
 		pthread_mutex_unlock(&locked_session->lock);
 	} else {
+		DEBUG("UNLOCK wrlock %s", __func__);
 		if (pthread_rwlock_unlock(&session_lock) != 0) {
-			ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, server, "Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+			DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 		}
 		reply = create_error("Invalid session identifier.");
 	}
@@ -1373,13 +1451,13 @@
 {
 	json_object *notif_history_array = (json_object *) pthread_getspecific(notif_history_key);
 	if (notif_history_array == NULL) {
-		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "No list of notification history found.");
+		DEBUG("No list of notification history found.");
 		return;
 	}
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "Got notification from history %lu.", (long unsigned) eventtime);
+	DEBUG("Got notification from history %lu.", (long unsigned) eventtime);
 	json_object *notif = json_object_new_object();
 	if (notif == NULL) {
-		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "Could not allocate memory for notification (json).");
+		DEBUG("Could not allocate memory for notification (json).");
 		return;
 	}
 	json_object_object_add(notif, "eventtime", json_object_new_int64(eventtime));
@@ -1387,7 +1465,7 @@
 	json_object_array_add(notif_history_array, notif);
 }
 
-json_object *handle_op_ntfgethistory(server_rec *server, apr_pool_t *pool, json_object *request, const char *session_key)
+json_object *handle_op_ntfgethistory(apr_pool_t *pool, json_object *request, const char *session_key)
 {
 	json_object *reply = NULL;
 	const char *sid = NULL;
@@ -1398,7 +1476,7 @@
 	time_t stop = 0;
 	int64_t from, to;
 
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Request: get notification history, session %s", session_key);
+	DEBUG("Request: get notification history, session %s", session_key);
 
 	sid = json_object_get_string(json_object_object_get(request, "session"));
 	from = json_object_get_int64(json_object_object_get(request, "from"));
@@ -1407,48 +1485,55 @@
 	start = time(NULL) + from;
 	stop = time(NULL) + to;
 
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "notification history interval %li %li", (long int) from, (long int) to);
+	DEBUG("notification history interval %li %li", (long int) from, (long int) to);
 
 	if (sid == NULL) {
 		return create_error("Missing session parameter.");
 	}
 
+	DEBUG("LOCK wrlock %s", __func__);
 	if (pthread_rwlock_rdlock(&session_lock) != 0) {
-		ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, server, "Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+		DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 		return NULL;
 	}
 
 	locked_session = (struct session_with_mutex *)apr_hash_get(netconf_sessions_list, session_key, APR_HASH_KEY_STRING);
 	if (locked_session != NULL) {
+		DEBUG("LOCK mutex %s", __func__);
 		pthread_mutex_lock(&locked_session->lock);
+		DEBUG("UNLOCK wrlock %s", __func__);
 		if (pthread_rwlock_unlock(&session_lock) != 0) {
-			ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, server, "Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+			DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 		}
-		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "creating temporal NC session.");
+		DEBUG("creating temporal NC session.");
 		temp_session = nc_session_connect_channel(locked_session->session, NULL);
 		if (temp_session != NULL) {
 			rpc = nc_rpc_subscribe(NULL /* stream */, NULL /* filter */, &start, &stop);
 			if (rpc == NULL) {
+				DEBUG("UNLOCK mutex %s", __func__);
 				pthread_mutex_unlock(&locked_session->lock);
-				ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "notifications: creating an rpc request failed.");
+				DEBUG("notifications: creating an rpc request failed.");
 				return create_error("notifications: creating an rpc request failed.");
 			}
 
-			ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, server, "Send NC subscribe.");
+			DEBUG("Send NC subscribe.");
 			/** \todo replace with sth like netconf_op(http_server, session_hash, rpc) */
-			json_object *res = netconf_unlocked_op(server, temp_session, rpc);
+			json_object *res = netconf_unlocked_op(temp_session, rpc);
 			if (res != NULL) {
+				DEBUG("UNLOCK mutex %s", __func__);
 				pthread_mutex_unlock(&locked_session->lock);
-				ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, server, "Subscription RPC failed.");
+				DEBUG("Subscription RPC failed.");
 				return res;
 			}
 			rpc = NULL; /* just note that rpc is already freed by send_recv_process() */
 
+			DEBUG("UNLOCK mutex %s", __func__);
 			pthread_mutex_unlock(&locked_session->lock);
+			DEBUG("LOCK mutex %s", __func__);
 			pthread_mutex_lock(&ntf_history_lock);
 			json_object *notif_history_array = json_object_new_array();
 			if (pthread_setspecific(notif_history_key, notif_history_array) != 0) {
-				ap_log_error(APLOG_MARK, APLOG_ERR, 0, http_server, "notif_history: cannot set thread-specific hash value.");
+				DEBUG("notif_history: cannot set thread-specific hash value.");
 			}
 
 			ncntf_dispatch_receive(temp_session, notification_history);
@@ -1457,17 +1542,20 @@
 			json_object_object_add(reply, "notifications", notif_history_array);
 			//json_object_put(notif_history_array);
 
+			DEBUG("UNLOCK mutex %s", __func__);
 			pthread_mutex_unlock(&ntf_history_lock);
-			ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "closing temporal NC session.");
+			DEBUG("closing temporal NC session.");
 			nc_session_free(temp_session);
 		} else {
+			DEBUG("UNLOCK mutex %s", __func__);
 			pthread_mutex_unlock(&locked_session->lock);
-			ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Get history of notification failed due to channel establishment");
+			DEBUG("Get history of notification failed due to channel establishment");
 			reply = create_error("Get history of notification was unsuccessful, connection failed.");
 		}
 	} else {
+		DEBUG("UNLOCK wrlock %s", __func__);
 		if (pthread_rwlock_unlock(&session_lock) != 0) {
-			ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, server, "Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+			DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 		}
 		reply = create_error("Invalid session identifier.");
 	}
@@ -1475,7 +1563,7 @@
 	return reply;
 }
 
-json_object *handle_op_validate(server_rec *server, apr_pool_t *pool, json_object *request, const char *session_key)
+json_object *handle_op_validate(apr_pool_t *pool, json_object *request, const char *session_key)
 {
 	json_object *reply = NULL;
 	const char *sid = NULL;
@@ -1485,7 +1573,7 @@
 	nc_rpc *rpc = NULL;
 	NC_DATASTORE target_ds;
 
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Request: validate datastore, session %s", session_key);
+	DEBUG("Request: validate datastore, session %s", session_key);
 
 	sid = json_object_get_string(json_object_object_get(request, "session"));
 	target = json_object_get_string(json_object_object_get(request, "target"));
@@ -1496,48 +1584,32 @@
 		return create_error("Missing session parameter.");
 	}
 
-	if (pthread_rwlock_rdlock(&session_lock) != 0) {
-		ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, server, "Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
-		return NULL;
-	}
-
-	locked_session = (struct session_with_mutex *)apr_hash_get(netconf_sessions_list, session_key, APR_HASH_KEY_STRING);
-	if (locked_session != NULL) {
-		pthread_mutex_lock(&locked_session->lock);
-		if (pthread_rwlock_unlock(&session_lock) != 0) {
-			ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, server, "Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+	/* validation */
+	target_ds = parse_datastore(target);
+	if (target_ds == NC_DATASTORE_URL) {
+		if (url != NULL) {
+			rpc = nc_rpc_validate(target_ds, url);
 		}
-		/* validation */
-		target_ds = parse_datastore(target);
-		if (target_ds == NC_DATASTORE_URL) {
-			if (url != NULL) {
-				rpc = nc_rpc_validate(target_ds, url);
-			}
-		} else if ((target_ds == NC_DATASTORE_RUNNING) || (target_ds == NC_DATASTORE_STARTUP)
+	} else if ((target_ds == NC_DATASTORE_RUNNING) || (target_ds == NC_DATASTORE_STARTUP)
 			|| (target_ds == NC_DATASTORE_CANDIDATE)) {
-			rpc = nc_rpc_validate(target_ds);
-		}
-		if (rpc == NULL) {
-			ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "mod_netconf: creating rpc request failed");
-			reply = create_error("Creation of RPC request failed.");
-			pthread_mutex_unlock(&locked_session->lock);
-			return reply;
-		}
-
-		if ((reply = netconf_op(server, session_key, rpc, NULL)) == NULL) {
-			reply = json_object_new_object();
-			json_object_object_add(reply, "type", json_object_new_int(REPLY_OK));
-		}
-		nc_rpc_free (rpc);
-
+		rpc = nc_rpc_validate(target_ds);
+	}
+	if (rpc == NULL) {
+		DEBUG("mod_netconf: creating rpc request failed");
+		reply = create_error("Creation of RPC request failed.");
+		DEBUG("UNLOCK mutex %s", __func__);
 		pthread_mutex_unlock(&locked_session->lock);
-	} else {
-		if (pthread_rwlock_unlock(&session_lock) != 0) {
-			ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, server, "Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
-		}
-		reply = create_error("Invalid session identifier.");
+		return reply;
 	}
 
+	DEBUG("Request: validate datastore");
+	if ((reply = netconf_op(session_key, rpc, NULL)) == NULL) {
+		reply = json_object_new_object();
+		json_object_object_add(reply, "type", json_object_new_int(REPLY_OK));
+	}
+	nc_rpc_free (rpc);
+
+	DEBUG("Request: validate datastore");
 	return reply;
 }
 
@@ -1558,7 +1630,7 @@
 	NC_DATASTORE ds_type_s = -1;
 	char *chunked_out_msg = NULL;
 	apr_pool_t * pool = ((struct pass_to_thread*)arg)->pool;
-	server_rec * server = ((struct pass_to_thread*)arg)->server;
+	//server_rec * server = ((struct pass_to_thread*)arg)->server;
 	int client = ((struct pass_to_thread*)arg)->client;
 
 	char *buffer = NULL;
@@ -1572,7 +1644,7 @@
 
 		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 */
-			//ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "poll interrupted");
+			//DEBUG("poll interrupted");
 			continue;
 		} else if (status < 0) {
 			/* 0:  poll time outed
@@ -1580,7 +1652,7 @@
 			 * -1: poll failed
 			 *     something wrong happend, close this socket and wait for another request
 			 */
-			//ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "poll failed, status %d(%d: %s)", status, errno, strerror(errno));
+			//DEBUG("poll failed, status %d(%d: %s)", status, errno, strerror(errno));
 			close(client);
 			break;
 		}
@@ -1591,26 +1663,26 @@
 		/* 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 */
-			//ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "socket error (%d)", fds.revents);
+			//DEBUG("socket error (%d)", fds.revents);
 			close(client);
 			break;
 		}
 
-		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Get framed message...");
-		buffer = get_framed_message(server, client);
+		DEBUG("Get framed message...");
+		buffer = get_framed_message(client);
 
-		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Check read buffer.");
+		DEBUG("Check read buffer.");
 		if (buffer != NULL) {
 			enum json_tokener_error jerr;
 			request = json_tokener_parse_verbose(buffer, &jerr);
 			if (jerr != json_tokener_success) {
-				ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "JSON parsing error");
+				DEBUG("JSON parsing error");
 				continue;
 			}
 			operation = json_object_get_int(json_object_object_get(request, "type"));
 
 			session_key = json_object_get_string(json_object_object_get(request, "session"));
-			ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "operation %d session_key %s.", operation, session_key);
+			DEBUG("operation %d session_key %s.", operation, session_key);
 			/* DO NOT FREE session_key HERE, IT IS PART OF REQUEST */
 			if (operation != MSG_CONNECT && session_key == NULL) {
 				reply = create_error("Missing session specification.");
@@ -1626,27 +1698,30 @@
 			err_reply = NULL;
 
 			/* prepare reply envelope */
+			if (reply != NULL) {
+				json_object_put(reply);
+			}
 			reply = NULL;
 
 			/* process required operation */
 			switch (operation) {
 			case MSG_CONNECT:
-				reply = handle_op_connect(server, pool, request);
+				reply = handle_op_connect(pool, request);
 				break;
 			case MSG_GET:
-				reply = handle_op_get(server, pool, request, session_key);
+				reply = handle_op_get(pool, request, session_key);
 				break;
 			case MSG_GETCONFIG:
-				reply = handle_op_getconfig(server, pool, request, session_key);
+				reply = handle_op_getconfig(pool, request, session_key);
 				break;
 			case MSG_GETSCHEMA:
-				reply = handle_op_getschema(server, pool, request, session_key);
+				reply = handle_op_getschema(pool, request, session_key);
 				break;
 			case MSG_EDITCONFIG:
-				reply = handle_op_editconfig(server, pool, request, session_key);
+				reply = handle_op_editconfig(pool, request, session_key);
 				break;
 			case MSG_COPYCONFIG:
-				reply = handle_op_copyconfig(server, pool, request, session_key);
+				reply = handle_op_copyconfig(pool, request, session_key);
 				break;
 
 			case MSG_DELETECONFIG:
@@ -1666,17 +1741,17 @@
 				}
 				switch(operation) {
 				case MSG_DELETECONFIG:
-					ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Request: delete-config (session %s)", session_key);
+					DEBUG("Request: delete-config (session %s)", session_key);
 					url = json_object_get_string(json_object_object_get(request, "url"));
-					reply = netconf_deleteconfig(server, session_key, ds_type_t, url);
+					reply = netconf_deleteconfig(session_key, ds_type_t, url);
 					break;
 				case MSG_LOCK:
-					ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Request: lock (session %s)", session_key);
-					reply = netconf_lock(server, session_key, ds_type_t);
+					DEBUG("Request: lock (session %s)", session_key);
+					reply = netconf_lock(session_key, ds_type_t);
 					break;
 				case MSG_UNLOCK:
-					ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Request: unlock (session %s)", session_key);
-					reply = netconf_unlock(server, session_key, ds_type_t);
+					DEBUG("Request: unlock (session %s)", session_key);
+					reply = netconf_unlock(session_key, ds_type_t);
 					break;
 				default:
 					reply = create_error("Internal: Unknown request type.");
@@ -1695,35 +1770,35 @@
 				}
 				break;
 			case MSG_KILL:
-				reply = handle_op_kill(server, pool, request, session_key);
+				reply = handle_op_kill(pool, request, session_key);
 				break;
 			case MSG_DISCONNECT:
-				reply = handle_op_disconnect(server, pool, request, session_key);
+				reply = handle_op_disconnect(pool, request, session_key);
 				break;
 			case MSG_RELOADHELLO:
-				reply = handle_op_reloadhello(server, pool, request, session_key);
+				reply = handle_op_reloadhello(pool, request, session_key);
 				break;
 			case MSG_INFO:
-				reply = handle_op_info(server, pool, request, session_key);
+				reply = handle_op_info(pool, request, session_key);
 				break;
 			case MSG_GENERIC:
-				reply = handle_op_generic(server, pool, request, session_key);
+				reply = handle_op_generic(pool, request, session_key);
 				break;
 			case MSG_NTF_GETHISTORY:
-				reply = handle_op_ntfgethistory(server, pool, request, session_key);
+				reply = handle_op_ntfgethistory(pool, request, session_key);
 				break;
 			case MSG_VALIDATE:
-				reply = handle_op_validate(server, pool, request, session_key);
+				reply = handle_op_validate(pool, request, session_key);
 				break;
 			default:
-				ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Unknown mod_netconf operation requested (%d)", operation);
+				DEBUG("Unknown mod_netconf operation requested (%d)", operation);
 				reply = create_error("Operation not supported.");
 				break;
 			}
-			ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Clean request json object.");
+			DEBUG("Clean request json object.");
 			json_object_put(request);
 
-			ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Send reply json object.");
+			DEBUG("Send reply json object.");
 			/* send reply to caller */
 			if (reply != NULL) {
 				msgtext = json_object_to_json_string(reply);
@@ -1734,20 +1809,25 @@
 					}
 					break;
 				}
-				ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Send framed reply json object.");
+				DEBUG("Send framed reply json object.");
 				send(client, chunked_out_msg, strlen(chunked_out_msg) + 1, 0);
-				ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Clean reply json object.");
+				DEBUG("Clean reply json object.");
 				json_object_put(reply);
-				ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Clean message buffer.");
+				reply = NULL;
+				DEBUG("Clean message buffer.");
 				free(chunked_out_msg);
 				chunked_out_msg = NULL;
 				if (buffer != NULL) {
 					free(buffer);
 					buffer = NULL;
 				}
+				if (err_reply != NULL) {
+					json_object_put(err_reply);
+					err_reply = NULL;
+				}
 			} else {
-				ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Reply is NULL, shouldn't be...");
-				break;
+				DEBUG("Reply is NULL, shouldn't be...");
+				continue;
 			}
 		}
 	}
@@ -1763,11 +1843,10 @@
  * sessions. This function iterates over the list of sessions and close them
  * all.
  *
- * \param[in] server  pointer to server_rec for logging
  * \param[in] p  apr pool needed for hash table iterating
  * \param[in] ht  hash table of session_with_mutex structs
  */
-static void close_all_nc_sessions(server_rec* server, apr_pool_t *p)
+static void close_all_nc_sessions(apr_pool_t *p)
 {
 	apr_hash_index_t *hi;
 	void *val = NULL;
@@ -1777,29 +1856,34 @@
 	int ret;
 
 	/* get exclusive access to sessions_list (conns) */
+	DEBUG("LOCK wrlock %s", __func__);
 	if ((ret = pthread_rwlock_wrlock (&session_lock)) != 0) {
-		ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, server, "Error while locking rwlock: %d (%s)", ret, strerror(ret));
+		DEBUG("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)) {
 		apr_hash_this(hi, (const void **) &hashed_key, &hashed_key_length, &val);
-		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Closing NETCONF session (%s).", hashed_key);
+		DEBUG("Closing NETCONF session (%s).", hashed_key);
 		swm = (struct session_with_mutex *) val;
 		if (swm != NULL) {
+			DEBUG("LOCK mutex %s", __func__);
+			pthread_mutex_lock(&swm->lock);
 			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(server, swm);
+			close_and_free_session(swm);
 		}
 	}
 	/* get exclusive access to sessions_list (conns) */
+	DEBUG("UNLOCK wrlock %s", __func__);
 	if (pthread_rwlock_unlock (&session_lock) != 0) {
-		ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, server, "Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+		DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 	}
 }
 
-static void check_timeout_and_close(server_rec* server, apr_pool_t *p)
+static void check_timeout_and_close(apr_pool_t *p)
 {
 	apr_hash_index_t *hi;
 	void *val = NULL;
@@ -1811,8 +1895,9 @@
 	int ret;
 
 	/* get exclusive access to sessions_list (conns) */
+//DEBUG("LOCK wrlock %s", __func__);
 	if ((ret = pthread_rwlock_wrlock (&session_lock)) != 0) {
-		ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, server, "Error while locking rwlock: %d (%s)", ret, strerror(ret));
+		DEBUG("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)) {
@@ -1825,22 +1910,26 @@
 		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)) {
-			ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Closing NETCONF session (%s).", hashed_key);
+			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(server, swm);
+			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) {
-		ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, server, "Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+		DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 	}
 }
 
@@ -1862,9 +1951,10 @@
 	socklen_t len;
 	mod_netconf_cfg *cfg;
 	struct pass_to_thread * arg;
-	pthread_t * ptids = calloc (1,sizeof(pthread_t));
+	pthread_t * ptids = calloc(1, sizeof(pthread_t));
 	struct timespec maxtime;
 	pthread_rwlockattr_t lock_attrs;
+	char *sockname = NULL;
 	#ifdef WITH_NOTIFICATIONS
 	char use_notifications = 0;
 	#endif
@@ -1875,49 +1965,54 @@
 	maxtime.tv_sec = 5;
 	maxtime.tv_nsec = 0;
 
+	#ifndef HTTPD_INDEPENDENT
 	/* change uid and gid of process for security reasons */
 	unixd_setup_child();
+	#endif
 
-	cfg = ap_get_module_config(server->module_config, &netconf_module);
-	if (cfg == NULL) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Getting mod_netconf configuration failed");
-		return;
+	if (server != NULL) {
+		cfg = ap_get_module_config(server->module_config, &netconf_module);
+		if (cfg == NULL) {
+			DEBUG("Getting mod_netconf configuration failed");
+			return;
+		}
+		sockname = cfg->sockname;
+	} else {
+		sockname = SOCKET_FILENAME;
 	}
 
 	/* create listening UNIX socket to accept incoming connections */
 	if ((lsock = socket(PF_UNIX, SOCK_STREAM, 0)) == -1) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Creating socket failed (%s)", strerror(errno));
-		return;
+		DEBUG("Creating socket failed (%s)", strerror(errno));
+		goto error_exit;
 	}
 
 	local.sun_family = AF_UNIX;
-	strncpy(local.sun_path, cfg->sockname, sizeof(local.sun_path));
+	strncpy(local.sun_path, sockname, sizeof(local.sun_path));
 	unlink(local.sun_path);
 	len = offsetof(struct sockaddr_un, sun_path) + strlen(local.sun_path);
 
 	if (bind(lsock, (struct sockaddr *) &local, len) == -1) {
 		if (errno == EADDRINUSE) {
-			ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "mod_netconf socket address already in use");
-			close(lsock);
-			exit(0);
+			DEBUG("mod_netconf socket address already in use");
+			goto error_exit;
 		}
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Binding socket failed (%s)", strerror(errno));
-		close(lsock);
-		return;
+		DEBUG("Binding socket failed (%s)", strerror(errno));
+		goto error_exit;
 	}
 
 	if (listen(lsock, MAX_SOCKET_CL) == -1) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Setting up listen socket failed (%s)", strerror(errno));
-		close(lsock);
-		return;
+		DEBUG("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);
 
 	/* prepare internal lists */
 	netconf_sessions_list = apr_hash_make(pool);
 
 	#ifdef WITH_NOTIFICATIONS
 	if (notification_init(pool, server) == -1) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "libwebsockets initialization failed");
+		DEBUG("libwebsockets initialization failed");
 		use_notifications = 0;
 	} else {
 		use_notifications = 1;
@@ -1926,7 +2021,6 @@
 
 	/* setup libnetconf's callbacks */
 	nc_verbosity(NC_VERB_DEBUG);
-	clb_print_server = server;
 	nc_callback_print(clb_print);
 	nc_callback_ssh_host_authenticity_check(netconf_callback_ssh_hostkey_check);
 	nc_callback_sshauth_interactive(netconf_callback_sshauth_interactive);
@@ -1942,13 +2036,13 @@
 	pthread_rwlockattr_setpshared(&lock_attrs, PTHREAD_PROCESS_PRIVATE);
 	/* create rw lock */
 	if (pthread_rwlock_init(&session_lock, &lock_attrs) != 0) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Initialization of mutex failed: %d (%s)", errno, strerror(errno));
-		close (lsock);
-		return;
+		DEBUG("Initialization of mutex failed: %d (%s)", errno, strerror(errno));
+		goto error_exit;
 	}
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "init of notif_history_key.");
+	pthread_mutex_init(&ntf_history_lock, NULL);
+	DEBUG("init of notif_history_key.");
 	if (pthread_key_create(&notif_history_key, NULL) != 0) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, http_server, "init of notif_history_key failed");
+		DEBUG("init of notif_history_key failed");
 	}
 
 	fcntl(lsock, F_SETFL, fcntl(lsock, F_GETFL, 0) | O_NONBLOCK);
@@ -1957,20 +2051,20 @@
 		timediff = (unsigned int)tv.tv_sec - olds;
 		#ifdef WITH_NOTIFICATIONS
 		if (timediff > 60) {
-			ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, server, "handling notifications");
+			DEBUG("handling notifications");
 		}
 		if (use_notifications == 1) {
 			notification_handle();
 		}
 		#endif
 		if (timediff > ACTIVITY_CHECK_INTERVAL) {
-			check_timeout_and_close(server, pool);
+			check_timeout_and_close(pool);
 		}
 
 		/* open incoming connection if any */
 		len = sizeof(remote);
 		if (((unsigned int)tv.tv_sec - olds) > 60) {
-			ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, server, "accepting another client");
+			DEBUG("accepting another client");
 			olds = tv.tv_sec;
 		}
 		client = accept(lsock, (struct sockaddr *) &remote, &len);
@@ -1980,7 +2074,7 @@
 		} else if (client == -1 && (errno == EINTR)) {
 			continue;
 		} else if (client == -1) {
-			ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Accepting mod_netconf client connection failed (%s)", strerror(errno));
+			DEBUG("Accepting mod_netconf client connection failed (%s)", strerror(errno));
 			continue;
 		}
 
@@ -1995,9 +2089,9 @@
 
 		/* 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) {
-			ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Creating POSIX thread failed: %d\n", ret);
+			DEBUG("Creating POSIX thread failed: %d\n", ret);
 		} else {
-			ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Thread %lu created", ptids[pthread_count]);
+			DEBUG("Thread %lu created", ptids[pthread_count]);
 			pthread_count++;
 			ptids = realloc (ptids, sizeof(pthread_t)*(pthread_count+1));
 			ptids[pthread_count] = 0;
@@ -2006,7 +2100,7 @@
 		/* check if some thread already terminated, free some resources by joining it */
 		for (i=0; i<pthread_count; i++) {
 			if (pthread_tryjoin_np (ptids[i], (void**)&arg) == 0) {
-				ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Thread %lu joined with retval %p", ptids[i], arg);
+				DEBUG("Thread %lu joined with retval %p", ptids[i], arg);
 				pthread_count--;
 				if (pthread_count > 0) {
 					/* place last Thread ID on the place of joined one */
@@ -2014,38 +2108,40 @@
 				}
 			}
 		}
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Running %d threads", pthread_count);
+		DEBUG("Running %d threads", pthread_count);
 	}
 
-	ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "mod_netconf terminating...");
+	DEBUG("mod_netconf terminating...");
 	/* join all threads */
 	for (i=0; i<pthread_count; i++) {
 		pthread_timedjoin_np (ptids[i], (void**)&arg, &maxtime);
 	}
-	free (ptids);
-
-	close(lsock);
 
 	#ifdef WITH_NOTIFICATIONS
 	notification_close();
 	#endif
 
 	/* close all NETCONF sessions */
-	close_all_nc_sessions(server, pool);
+	close_all_nc_sessions(pool);
 
 	/* destroy rwlock */
 	pthread_rwlock_destroy(&session_lock);
 	pthread_rwlockattr_destroy(&lock_attrs);
 
-	ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Exiting from the mod_netconf daemon");
+	DEBUG("Exiting from the mod_netconf daemon");
 
+	free(ptids);
+	close(lsock);
 	exit(APR_SUCCESS);
+	return;
+error_exit:
+	close(lsock);
+	free(ptids);
+	return;
 }
 
 static void *mod_netconf_create_conf(apr_pool_t * pool, server_rec * s)
 {
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, "Init netconf module config");
-
 	mod_netconf_cfg *config = apr_pcalloc(pool, sizeof(mod_netconf_cfg));
 	apr_pool_create(&config->pool, pool);
 	config->forkproc = NULL;
@@ -2054,6 +2150,7 @@
 	return (void *)config;
 }
 
+#ifndef HTTPD_INDEPENDENT
 static int mod_netconf_master_init(apr_pool_t * pconf, apr_pool_t * ptemp,
 		  apr_pool_t * plog, server_rec * s)
 {
@@ -2075,7 +2172,7 @@
 		return (OK);
 	}
 
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, "creating mod_netconf daemon");
+	DEBUG("creating mod_netconf daemon");
 	config = ap_get_module_config(s->module_config, &netconf_module);
 
 	if (config && config->forkproc == NULL) {
@@ -2088,13 +2185,13 @@
 			apr_signal(SIGTERM, signal_handler);
 
 			/* log start of the separated NETCONF communication process */
-			ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s, "mod_netconf daemon started (PID %d)", getpid());
+			DEBUG("mod_netconf daemon started (PID %d)", getpid());
 
 			/* start main loop providing NETCONF communication */
 			forked_proc(config->pool, s);
 
 			/* I never should be here, wtf?!? */
-			ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, "mod_netconf daemon unexpectedly stopped");
+			DEBUG("mod_netconf daemon unexpectedly stopped");
 			exit(APR_EGENERAL);
 			break;
 		case APR_INPARENT:
@@ -2102,22 +2199,25 @@
 			apr_pool_note_subprocess(config->pool, config->forkproc, APR_KILL_AFTER_TIMEOUT);
 			break;
 		default:
-			ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, "apr_proc_fork() failed");
+			DEBUG("apr_proc_fork() failed");
 			break;
 		}
 	} else {
-		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, "mod_netconf misses configuration structure");
+		DEBUG("mod_netconf misses configuration structure");
 	}
 
 	return OK;
 }
+#endif
 
 /**
  * Register module hooks
  */
 static void mod_netconf_register_hooks(apr_pool_t * p)
 {
+#ifndef HTTPD_INDEPENDENT
 	ap_hook_post_config(mod_netconf_master_init, NULL, NULL, APR_HOOK_LAST);
+#endif
 }
 
 static const char* cfg_set_socket_path(cmd_parms* cmd, void* cfg, const char* arg)
@@ -2142,3 +2242,16 @@
 	mod_netconf_register_hooks	/* register hooks                      */
 };
 
+int main(int argc, char **argv)
+{
+	apr_pool_t *pool;
+	apr_app_initialize(&argc, (char const *const **) &argv, NULL);
+	apr_signal(SIGTERM, signal_handler);
+	apr_signal(SIGINT, signal_handler);
+	apr_pool_create(&pool, NULL);
+	forked_proc(pool, NULL);
+	apr_pool_destroy(pool);
+	apr_terminate();
+	DEBUG("Terminated");
+	return 0;
+}
diff --git a/src/mod_netconf.h b/src/mod_netconf.h
index 1abf803..bd497a7 100644
--- a/src/mod_netconf.h
+++ b/src/mod_netconf.h
@@ -85,6 +85,22 @@
 extern pthread_rwlock_t session_lock; /**< mutex protecting netconf_session_list from multiple access errors */
 
 json_object *create_error(const char *errmess);
+json_object *create_ok();
+
+extern server_rec *http_server;
+#ifndef HTTPD_INDEPENDENT
+# define APLOGERROR(...) ap_log_error(APLOG_MARK, APLOG_ERR, 0, http_server, __VA_ARGS__);
+#else
+# define APLOGERROR(...)
+#endif
+#define DEBUG(...) do { \
+	if (http_server != NULL) { \
+		APLOGERROR(__VA_ARGS__); \
+	} else { \
+		fprintf(stderr, __VA_ARGS__); \
+		fprintf(stderr, "\n"); \
+	} \
+} while (0);
 
 #endif
 
diff --git a/src/notification-server.c b/src/notification-server.c
index 5701403..fbab20d 100644
--- a/src/notification-server.c
+++ b/src/notification-server.c
@@ -51,7 +51,6 @@
 static int *fd_lookup;
 static int count_pollfds;
 static struct libwebsocket_context *context = NULL;
-static server_rec *http_server = NULL;
 
 struct ntf_thread_config {
 	struct nc_session *session;
@@ -380,20 +379,12 @@
 	switch (nc_session_send_recv(session, rpc, &reply)) {
 	case NC_MSG_UNKNOWN:
 		if (nc_session_get_status(session) != NC_SESSION_STATUS_WORKING) {
-			#ifndef TEST_NOTIFICATION_SERVER
-			if (http_server != NULL) {
-				ap_log_error(APLOG_MARK, APLOG_ERR, 0, http_server, "notifications: receiving rpc-reply failed.");
-			}
-			#endif
+			DEBUG("notifications: receiving rpc-reply failed.");
 			//cmd_disconnect(NULL);
 			ret = EXIT_FAILURE;
 			break;
 		}
-		#ifndef TEST_NOTIFICATION_SERVER
-		if (http_server != NULL) {
-			ap_log_error(APLOG_MARK, APLOG_ERR, 0, http_server, "notifications: Unknown error occurred.");
-		}
-		#endif
+		DEBUG("notifications: Unknown error occurred.");
 		ret = EXIT_FAILURE;
 		break;
 	case NC_MSG_NONE:
@@ -404,38 +395,22 @@
 		case NC_REPLY_OK:
 			break;
 		case NC_REPLY_DATA:
-			#ifndef TEST_NOTIFICATION_SERVER
-			if (http_server != NULL) {
-				ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "notifications: recv: %s.", data = nc_reply_get_data (reply));
-				free(data);
-			}
-			#endif
+			DEBUG("notifications: recv: %s.", data = nc_reply_get_data (reply));
+			free(data);
 			break;
 		case NC_REPLY_ERROR:
 			/* wtf, you shouldn't be here !?!? */
-			#ifndef TEST_NOTIFICATION_SERVER
-			if (http_server != NULL) {
-				ap_log_error(APLOG_MARK, APLOG_ERR, 0, http_server, "notifications: operation failed, but rpc-error was not processed.");
-			}
-			#endif
+			DEBUG("notifications: operation failed, but rpc-error was not processed.");
 			ret = EXIT_FAILURE;
 			break;
 		default:
-			#ifndef TEST_NOTIFICATION_SERVER
-			if (http_server != NULL) {
-				ap_log_error(APLOG_MARK, APLOG_ERR, 0, http_server, "notifications: unexpected operation result.");
-			}
-			#endif
+			DEBUG("notifications: unexpected operation result.");
 			ret = EXIT_FAILURE;
 			break;
 		}
 		break;
 	default:
-		#ifndef TEST_NOTIFICATION_SERVER
-		if (http_server != NULL) {
-			ap_log_error(APLOG_MARK, APLOG_ERR, 0, http_server, "notifications: Unknown error occurred.");
-		}
-		#endif
+		DEBUG("notifications: Unknown error occurred.");
 		ret = EXIT_FAILURE;
 		break;
 	}
@@ -456,51 +431,45 @@
 	notification_t *ntf = NULL;
 	char *session_hash = NULL;
 
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "Accepted notif: %lu %s\n", (unsigned long int) eventtime, content);
+	DEBUG("Accepted notif: %lu %s\n", (unsigned long int) eventtime, content);
 
 	session_hash = pthread_getspecific(thread_key);
-	if (http_server != NULL) {
-		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "notification: fileprint getspecific (%s)", session_hash);
-	}
+	DEBUG("notification: fileprint getspecific (%s)", session_hash);
 	if (pthread_rwlock_wrlock(&session_lock) != 0) {
-		#ifndef TEST_NOTIFICATION_SERVER
-		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "Error while locking rwlock");
-		#endif
+		DEBUG("Error while locking rwlock");
 		return;
 	}
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "Get session with mutex from key %s.", session_hash);
+	DEBUG("Get session with mutex from key %s.", session_hash);
 	target_session = get_ncsession_from_key(session_hash);
 	if (target_session == NULL) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, http_server, "no session found last_session_key (%s)", session_hash);
+		DEBUG("no session found last_session_key (%s)", session_hash);
 		if (pthread_rwlock_unlock (&session_lock) != 0) {
-			ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, http_server, "Error while unlocking rwlock");
+			DEBUG("Error while unlocking rwlock");
 			return;
 		}
 		return;
 	}
 	if (pthread_mutex_lock(&target_session->lock) != 0) {
-		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "Error while locking rwlock");
+		DEBUG("Error while locking rwlock");
 	}
 	if (pthread_rwlock_unlock(&session_lock) != 0) {
-		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "Error while locking rwlock");
+		DEBUG("Error while locking rwlock");
 	}
 
 	if (target_session->notifications == NULL) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, http_server, "target_session->notifications is NULL");
+		DEBUG("target_session->notifications is NULL");
 		if (pthread_mutex_unlock(&target_session->lock) != 0) {
-			ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, http_server, "Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+			DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 			return;
 		}
 		return;
 	}
-	if (http_server != NULL) {
-		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "notification: ready to push to notifications queue");
-	}
+	DEBUG("notification: ready to push to notifications queue");
 	ntf = (notification_t *) apr_array_push(target_session->notifications);
 	if (ntf == NULL) {
-		ap_log_error (APLOG_MARK, APLOG_ERR, 0, http_server, "Failed to allocate element ");
+		DEBUG("Failed to allocate element ");
 		if (pthread_mutex_unlock(&target_session->lock) != 0) {
-			ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "Error while unlocking rwlock");
+			DEBUG("Error while unlocking rwlock");
 			return;
 		}
 		return;
@@ -508,10 +477,10 @@
 	ntf->eventtime = eventtime;
 	ntf->content = strdup(content);
 
-	ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, http_server, "added notif to queue %u (%s)", (unsigned int) ntf->eventtime, "notifikace");
+	DEBUG("added notif to queue %u (%s)", (unsigned int) ntf->eventtime, "notification");
 
 	if (pthread_mutex_unlock(&target_session->lock) != 0) {
-		ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, http_server, "Error while unlocking rwlock");
+		DEBUG("Error while unlocking rwlock");
 	}
 }
 
@@ -522,19 +491,22 @@
 void* notification_thread(void* arg)
 {
 	struct ntf_thread_config *config = (struct ntf_thread_config*)arg;
-	ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, http_server, "notifications: in thread for libnetconf notifications");
+	DEBUG("notifications: in thread for libnetconf notifications");
 
 	/* store hash identification of netconf session for notifications printing callback */
 	if (pthread_setspecific(thread_key, config->session_hash) != 0) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, http_server, "notifications: cannot set thread-specific hash value.");
+		DEBUG("notifications: cannot set thread-specific hash value.");
 	}
 
-	if (http_server != NULL) {
-		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "notifications: dispatching");
-	}
+	DEBUG("notifications: dispatching");
 	ncntf_dispatch_receive(config->session, notification_fileprint);
-	ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, http_server, "notifications: ended thread for libnetconf notifications");
-	//free(config);
+	DEBUG("notifications: ended thread for libnetconf notifications");
+	if (config->session_hash != NULL) {
+		free(config->session_hash);
+	}
+	if (config != NULL) {
+		free(config);
+	}
 	return (NULL);
 }
 
@@ -550,12 +522,10 @@
 	struct ntf_thread_config *tconfig;
 	struct nc_session *session;
 
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "notif_subscribe");
+	DEBUG("notif_subscribe");
 	if (locked_session == NULL) {
-		if (http_server != NULL) {
-			ap_log_error(APLOG_MARK, APLOG_ERR, 0, http_server, "notifications: no locked_session was given.");
-		}
-		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "Close notification client");
+		DEBUG("notifications: no locked_session was given.");
+		DEBUG("Close notification client");
 		return -1;
 	}
 
@@ -564,57 +534,56 @@
 
 	start = time(NULL) + start_time;
 	stop = time(NULL) + stop_time;
-	if (http_server != NULL) { ap_log_error(APLOG_MARK, APLOG_ERR, 0, http_server, "notifications: history: %u %u", (unsigned int) start, (unsigned int) stop);
-	}
+	DEBUG("notifications: history: %u %u", (unsigned int) start, (unsigned int) stop);
 
 	if (session == NULL) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, http_server, "notifications: NETCONF session not established.");
+		DEBUG("notifications: NETCONF session not established.");
 		goto operation_failed;
 	}
 
 	/* check if notifications are allowed on this session */
 	if (nc_session_notif_allowed(session) == 0) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, http_server, "notifications: Notification subscription is not allowed on this session.");
+		DEBUG("notifications: Notification subscription is not allowed on this session.");
 		goto operation_failed;
 	}
 	/* check times */
 	if (start != -1 && stop != -1 && start > stop) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, http_server, "notifications: Subscription start time must be lower than the end time.");
+		DEBUG("notifications: Subscription start time must be lower than the end time.");
 		goto operation_failed;
 	}
 
-	ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, http_server, "Prepare to execute subscription.");
+	DEBUG("Prepare to execute subscription.");
 	/* create requests */
 	rpc = nc_rpc_subscribe(stream, filter, (start_time == 0)?NULL:&start, (stop_time == 0)?NULL:&stop);
 	nc_filter_free(filter);
 	if (rpc == NULL) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, http_server, "notifications: creating an rpc request failed.");
+		DEBUG("notifications: creating an rpc request failed.");
 		goto operation_failed;
 	}
 
-	ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, http_server, "Send NC subscribe.");
+	DEBUG("Send NC subscribe.");
 	/** \todo replace with sth like netconf_op(http_server, session_hash, rpc) */
 	if (send_recv_process(session, "subscribe", rpc) != 0) {
-		ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, http_server, "Subscription RPC failed.");
+		DEBUG("Subscription RPC failed.");
 		goto operation_failed;
 	}
 	rpc = NULL; /* just note that rpc is already freed by send_recv_process() */
 	locked_session->ntfc_subscribed = 1;
 
-	ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, http_server, "Create config for notification_thread.");
+	DEBUG("Create config for notification_thread.");
 	tconfig = malloc(sizeof(struct ntf_thread_config));
 	tconfig->session = session;
 	tconfig->session_hash = strdup(session_hash);
-	ap_log_error(APLOG_MARK, APLOG_ERR, 0, http_server, "notifications: creating libnetconf notification thread (%s).", tconfig->session_hash);
+	DEBUG("notifications: creating libnetconf notification thread (%s).", tconfig->session_hash);
 
 	pthread_mutex_unlock(&locked_session->lock);
-	ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, http_server, "Create notification_thread.");
+	DEBUG("Create notification_thread.");
 	if (pthread_create(&thread, NULL, notification_thread, tconfig) != 0) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, http_server, "notifications: creating a thread for receiving notifications failed");
+		DEBUG("notifications: creating a thread for receiving notifications failed");
 		return -1;
 	}
 	pthread_detach(thread);
-	ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, http_server, "Subscription finished.");
+	DEBUG("Subscription finished.");
 	return 0;
 
 operation_failed:
@@ -635,59 +604,57 @@
 
 	switch (reason) {
 	case LWS_CALLBACK_ESTABLISHED:
-		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "notification client connected.");
+		DEBUG("notification client connected.");
 		break;
 
 	case LWS_CALLBACK_SERVER_WRITEABLE:
 		if (pss->session_key == NULL) {
 			return 0;
 		}
-		//ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "Callback server writeable.");
-		//ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "lock session lock.");
+		//DEBUG("Callback server writeable.");
+		//DEBUG("lock session lock.");
 		if (pthread_rwlock_wrlock (&session_lock) != 0) {
-			ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, http_server, "Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+			DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 			return -1;
 		}
-		//ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "get session_with_mutex for %s.", pss->session_key);
+		//DEBUG("get session_with_mutex for %s.", pss->session_key);
 		struct session_with_mutex *ls = get_ncsession_from_key(pss->session_key);
 		if (ls == NULL) {
-			if (http_server != NULL) {
-				ap_log_error(APLOG_MARK, APLOG_ERR, 0, http_server, "notification: session not found");
-			}
+			DEBUG("notification: session not found");
 			if (pthread_rwlock_unlock (&session_lock) != 0) {
-				ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, http_server, "Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+				DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 				return -1;
 			}
 			return -1;
 		}
 		pthread_mutex_lock(&ls->lock);
 		if (pthread_rwlock_unlock (&session_lock) != 0) {
-			ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, http_server, "Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+			DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 		}
 
-		//ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "check for closed session.");
+		//DEBUG("check for closed session.");
 		if (ls->closed == 1) {
-			ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "unlock session key.");
+			DEBUG("unlock session key.");
 			if (pthread_rwlock_unlock (&session_lock) != 0) {
-				ap_log_error (APLOG_MARK, APLOG_DEBUG, 0, http_server, "Error while unlocking unlock: %d (%s)", errno, strerror(errno));
+				DEBUG("Error while unlocking unlock: %d (%s)", errno, strerror(errno));
 				return -1;
 			}
 			return -1;
 		}
-		//ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "lock private lock.");
+		//DEBUG("lock private lock.");
 		notification_t *notif = NULL;
-		//ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "check for uninitialized notification list.");
+		//DEBUG("check for uninitialized notification list.");
 		if (ls->notifications == NULL) {
-				ap_log_error(APLOG_MARK, APLOG_ERR, 0, http_server, "notification: no notifications array");
-			ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "unlock private lock.");
+				DEBUG("notification: no notifications array");
+			DEBUG("unlock private lock.");
 			if (pthread_mutex_unlock(&ls->lock) != 0) {
-				ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "notification: cannot unlock session");
+				DEBUG("notification: cannot unlock session");
 			}
 			return -1;
 		}
-		//ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "check for empty notification list.");
+		//DEBUG("check for empty notification list.");
 		if (!apr_is_empty_array(ls->notifications)) {
-			ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "notification: POP notifications for session");
+			DEBUG("notification: POP notifications for session");
 
 			while ((notif = (notification_t *) apr_array_pop(ls->notifications)) != NULL) {
 				n = 0;
@@ -699,7 +666,7 @@
 
 				//n = sprintf((char *)p, "{\"eventtime\": \"%s\", \"content\": \"notification\"}", t);
 				n = sprintf((char *)p, "%s", msgtext);
-				ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "ws send %dB in %lu", n, sizeof(buf));
+				DEBUG("ws send %dB in %lu", n, sizeof(buf));
 				m = libwebsocket_write(wsi, p, n, LWS_WRITE_TEXT);
 				if (lws_send_pipe_choked(wsi)) {
 					libwebsocket_callback_on_writable(context, wsi);
@@ -707,26 +674,27 @@
 				}
 
 				json_object_put(notif_json);
+				free(notif->content);
 			}
-			ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "notification: POP notifications done");
+			DEBUG("notification: POP notifications done");
 		}
 
-		//ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "unlock private lock");
+		//DEBUG("unlock private lock");
 		if (pthread_mutex_unlock(&ls->lock) != 0) {
-			ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "notification: cannot unlock session");
+			DEBUG("notification: cannot unlock session");
 		}
-		//ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "unlock session lock");
+		//DEBUG("unlock session lock");
 
 		if (m < n) {
-			ap_log_error(APLOG_MARK, APLOG_ERR, 0, http_server, "ERROR %d writing to di socket.", n);
+			DEBUG("ERROR %d writing to di socket.", n);
 
 			return -1;
 		}
 		break;
 
 	case LWS_CALLBACK_RECEIVE:
-		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "Callback receive.");
-		ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, http_server, "received: (%s)", (char *)in);
+		DEBUG("Callback receive.");
+		DEBUG("received: (%s)", (char *)in);
 		if (pss->session_key == NULL) {
 			char session_key_buf[41];
 			int start = -1;
@@ -736,49 +704,49 @@
 			session_key_buf[40] = '\0';
 			pss->session_key = strdup(session_key_buf);
 			sscanf(in+40, "%d %d", (int *) &start, (int *) &stop);
-			ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, http_server, "notification: get key (%s) from (%s) (%i,%i)", pss->session_key, (char *) in, (int) start, (int) stop);
+			DEBUG("notification: get key (%s) from (%s) (%i,%i)", pss->session_key, (char *) in, (int) start, (int) stop);
 
-			ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "lock session lock");
+			DEBUG("lock session lock");
 			if (pthread_rwlock_rdlock (&session_lock) != 0) {
-				ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "Error while locking rwlock: %d (%s)", errno, strerror(errno));
+				DEBUG("Error while locking rwlock: %d (%s)", errno, strerror(errno));
 				return -1;
 			}
-			ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "get session from key (%s)", pss->session_key);
+			DEBUG("get session from key (%s)", pss->session_key);
 			struct session_with_mutex *ls = get_ncsession_from_key(pss->session_key);
 			if (ls == NULL) {
-				ap_log_error(APLOG_MARK, APLOG_ERR, 0, http_server, "notification: session_key not found (%s)", pss->session_key);
-				ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "unlock session lock");
+				DEBUG("notification: session_key not found (%s)", pss->session_key);
+				DEBUG("unlock session lock");
 				if (pthread_rwlock_unlock (&session_lock) != 0) {
-					ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+					DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 				}
-				ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "Close notification client");
+				DEBUG("Close notification client");
 				return -1;
 			}
-			ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "lock private lock");
+			DEBUG("lock private lock");
 			pthread_mutex_lock(&ls->lock);
 
-			ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "unlock session lock");
+			DEBUG("unlock session lock");
 			if (pthread_rwlock_unlock (&session_lock) != 0) {
-				ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
+				DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 			}
 
-			ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "Found session to subscribe notif.");
+			DEBUG("Found session to subscribe notif.");
 			if (ls->closed == 1) {
-				ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, http_server, "session already closed - handle no notification");
-				ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "unlock private lock");
+				DEBUG("session already closed - handle no notification");
+				DEBUG("unlock private lock");
 				pthread_mutex_unlock(&ls->lock);
-				ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "Close notification client");
+				DEBUG("Close notification client");
 				return -1;
 			}
 			if (ls->ntfc_subscribed != 0) {
-				ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "notification: already subscribed");
-				ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "unlock private lock");
+				DEBUG("notification: already subscribed");
+				DEBUG("unlock private lock");
 				pthread_mutex_unlock(&ls->lock);
 				/* do not close client, only do not subscribe again */
 				return 0;
 			}
-			ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "notification: prepare to subscribe stream");
-			ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "unlock session lock");
+			DEBUG("notification: prepare to subscribe stream");
+			DEBUG("unlock session lock");
 			pthread_mutex_unlock(&ls->lock);
 
 			/* notif_subscribe locks on its own */
@@ -797,6 +765,14 @@
 		//dump_handshake_info(wsi);
 		/* you could return non-zero here and kill the connection */
 		break;
+	//gives segfailt :-(
+	//case LWS_CALLBACK_CLOSED:
+	//	if (pss->session_key != NULL) {
+	//		free(pss->session_key);
+	//	}
+	//	if (pss != NULL) {
+	//		free(pss);
+	//	}
 
 	default:
 		break;
@@ -846,8 +822,7 @@
 	/* tell the library what debug level to emit and to send it to syslog */
 	lws_set_log_level(debug_level, lwsl_emit_syslog);
 
-	http_server = server;
-	ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, http_server, "Initialization of libwebsocket");
+	DEBUG("Initialization of libwebsocket");
 	//lwsl_notice("libwebsockets test server - "
 	//		"(C) Copyright 2010-2013 Andy Green <andy@warmcat.com> - "
 	//					    "licensed under LGPL2.1\n");
@@ -855,7 +830,7 @@
 	pollfds = malloc(max_poll_elements * sizeof (struct pollfd));
 	fd_lookup = malloc(max_poll_elements * sizeof (int));
 	if (pollfds == NULL || fd_lookup == NULL) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, http_server, "Out of memory pollfds=%d\n", max_poll_elements);
+		DEBUG("Out of memory pollfds=%d\n", max_poll_elements);
 		return -1;
 	}
 
@@ -875,13 +850,13 @@
 	/* create server */
 	context = libwebsocket_create_context(&info);
 	if (context == NULL) {
-		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "libwebsocket init failed.");
+		DEBUG("libwebsocket init failed.");
 		return -1;
 	}
 
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, http_server, "notifications: init of pthread_key_create.");
+	DEBUG("notifications: init of pthread_key_create.");
 	if (pthread_key_create(&thread_key, NULL) != 0) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, http_server, "notifications: pthread_key_create failed");
+		DEBUG("notifications: pthread_key_create failed");
 	}
 	return 0;
 }
@@ -889,8 +864,10 @@
 void notification_close()
 {
 	libwebsocket_context_destroy(context);
+	free(pollfds);
+	free(fd_lookup);
 
-	ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, http_server, "libwebsockets-test-server exited cleanly\n");
+	DEBUG("libwebsockets-test-server exited cleanly\n");
 }
 
 
