diff --git a/Knot.files b/Knot.files
index 0948839ab7bfb3499a69a21b77e6c7e22eeb8fa0..8733ea018911313dbde1859d7d67d4c426d7a11d 100644
--- a/Knot.files
+++ b/Knot.files
@@ -7,7 +7,6 @@ configure.ac
 KNOWN_ISSUES
 README
 tests/querytcp.c
-src/libknot/Makefile.am
 src/libknot/libknot.h
 src/libknot/common.h
 src/libknot/dname.h
diff --git a/src/libknot/dname.c b/src/libknot/dname.c
index 0a887236c61b4d7b66c988539eedf65389be755a..c444bc6cd0229675d20a5b147a5e91d3dbfe65ed 100644
--- a/src/libknot/dname.c
+++ b/src/libknot/dname.c
@@ -492,8 +492,6 @@ knot_dname_t *knot_dname_parse_from_wire(const uint8_t *wire,
 
 		if (knot_wire_is_pointer(wire + p)) {
 			// pointer.
-
-//			printf("Pointer.\n");
 			size_t ptr = knot_wire_get_pointer(wire + p);
 
 			/* Check that the pointer points backwards
diff --git a/src/libknot/hash/cuckoo-hash-table.c b/src/libknot/hash/cuckoo-hash-table.c
index 617f8fc6e04374525c16f1c2234d7310ec0e7fe0..7358e14c23ece885647becbdf93947aed8732ee7 100644
--- a/src/libknot/hash/cuckoo-hash-table.c
+++ b/src/libknot/hash/cuckoo-hash-table.c
@@ -937,8 +937,6 @@ void ck_destroy_table(ck_hash_table_t **table, void (*dtor_value)(void *value),
 	for (uint t = 0; t < (*table)->table_count; ++t) {
 		free((*table)->tables[t]);
 	}
-	// destroy stash
-//	da_destroy(&(*table)->stash);
 
 	pthread_mutex_unlock(&(*table)->mtx_table);
 	// destroy mutex, assuming that here noone will lock the mutex again
@@ -1043,7 +1041,6 @@ int ck_resize_table(ck_hash_table_t *table)
 	}
 	
 	return ck_rehash(table);
-	//return 0;
 }
 
 int ck_insert_item(ck_hash_table_t *table, const char *key,
@@ -1075,9 +1072,6 @@ int ck_insert_item(ck_hash_table_t *table, const char *key,
 		}
 	}
 
-	// there should be at least 2 free places
-	//assert(da_try_reserve(&table->stash, 2) == 0);
-	//da_reserve(&table->stash, 1);
 	ck_hash_table_item_t *free_place = NULL;
 	if (ck_hash_item(table, &new_item, &free_place,
 	                 table->generation) != 0) {
@@ -1602,7 +1596,6 @@ int ck_rehash(ck_hash_table_t *table)
 		// which will be put to the stash
 		ck_hash_table_item_t *free = NULL;
 		assert(table->hashed == NULL);
-//		ck_hash_table_item_t *old = table->hashed;
 
 		for (uint t = 0; t < table->table_count; ++t) {
 			uint rehashed = 0;
diff --git a/src/libknot/nameserver/name-server.c b/src/libknot/nameserver/name-server.c
index 1d93cb8fe33ae2cec4f4b53bda6857294d08f280..cdd6c83313ec37b52109ab02961aa919a807d7f9 100644
--- a/src/libknot/nameserver/name-server.c
+++ b/src/libknot/nameserver/name-server.c
@@ -129,7 +129,6 @@ static knot_rrset_t *ns_synth_from_wildcard(
 	dbg_ns_verb("Synthetizing RRSet from wildcard...\n");
 
 	knot_dname_t *owner = knot_dname_deep_copy(qname);
-//	printf("Copied owner ptr: %p\n", owner);
 
 	knot_rrset_t *synth_rrset = knot_rrset_new(
 			owner, knot_rrset_type(wildcard_rrset),
@@ -168,7 +167,6 @@ static knot_rrset_t *ns_synth_from_wildcard(
 		rdata = knot_rrset_rdata_next(wildcard_rrset, rdata);
 	}
 
-//	printf("Synthetized RRSet pointer: %p\n", synth_rrset);
 	return synth_rrset;
 }
 
@@ -609,11 +607,6 @@ dbg_ns_exec_detail(
 			// name
 			dbg_ns_detail("Node is wildcard.\n");
 			assert(knot_dname_is_wildcard(knot_node_owner(node)));
-
-//			// the stored node should be the closest encloser
-//			assert(knot_dname_is_subdomain(dname, node->owner));
-//			// try the wildcard child, if any
-//			node = knot_node_wildcard_child(node);
 		}
 
 		knot_rrset_t *rrset_add;
@@ -1695,9 +1688,6 @@ static inline int ns_referral(const knot_node_t *node,
 	
 	knot_rrset_t *rrset = knot_node_get_rrset(node, KNOT_RRTYPE_NS);
 	assert(rrset != NULL);
-
-	// TODO: wildcards??
-	//ns_check_wildcard(name, resp, &rrset);
 	
 	ret = knot_response_add_rrset_authority(resp, rrset, 1, 0, 0, 1);
 	if (ret == KNOT_EOK) {
@@ -1760,7 +1750,6 @@ static inline int ns_referral(const knot_node_t *node,
 		knot_response_set_rcode(resp, KNOT_RCODE_NOERROR);
 		ret = KNOT_EOK;
 	} else if (ret == KNOT_EOK) {
-//		(void)ns_put_additional(resp);
 		knot_response_set_rcode(resp, KNOT_RCODE_NOERROR);
 	}
 
@@ -1854,9 +1843,6 @@ static int ns_answer_from_node(const knot_node_t *node,
 		}
 	}
 
-//	if (ret == KNOT_EOK) {
-//		ns_put_additional(resp);
-//	}
 	return ret;
 }
 
@@ -2071,13 +2057,9 @@ static int ns_answer_from_zone(const knot_zone_contents_t *zone,
 
 search:
 #ifdef USE_HASH_TABLE
-	/*! \todo Check version. */
 	find_ret = knot_zone_contents_find_dname_hash(zone, qname, &node,
 	                                                &closest_encloser);
-//	node = knot_node_current(node);
-//	closest_encloser = knot_node_current(closest_encloser);
 #else
-	/*! \todo Check version. */
 	find_ret = knot_zone_contents_find_dname(zone, qname, &node,
 	                                          &closest_encloser, &previous);
 	node = knot_node_current(node);
@@ -2200,7 +2182,8 @@ dbg_ns_exec(
 		const knot_dname_t *act_name = qname;
 		ret = ns_follow_cname(&node, &act_name, resp,
 		                      knot_response_add_rrset_answer, 1);
-/* POZOR!! je ok?? */
+
+		/*! \todo IS OK??? */
 		knot_response_set_aa(resp);
 
 		if (ret != KNOT_EOK) {
@@ -2356,7 +2339,6 @@ int ns_response_to_wire(knot_packet_t *resp, uint8_t *wire,
 	}
 	
 	*wire_size = rsize;
-	//free(rwire);
 
 	return KNOT_EOK;
 }
@@ -2462,7 +2444,6 @@ static int ns_xfr_send_and_clear(knot_ns_xfr_t *xfr, int add_tsig)
 		xfr->tsig_data_size += real_size;
 	}
 
-	/*! \note [TSIG] Generate TSIG if required (during XFR/IN). */
 	if (xfr->tsig_key && add_tsig) {
 		if (xfr->packet_nr == 0) {
 			/* Add key, digest and digest length. */
@@ -2785,9 +2766,7 @@ static int ns_ixfr_put_rrset(knot_ns_xfr_t *xfr, knot_rrset_t *rrset)
 		/*! \todo Probably send back AXFR instead. */
 		knot_response_set_rcode(xfr->response,
 		                           KNOT_RCODE_SERVFAIL);
-		/*! \todo Probably rename the function. */
 		ns_xfr_send_and_clear(xfr, 1);
-		//socket_close(xfr->session);  /*! \todo Remove for UDP.*/
 		return res;
 	}
 
@@ -2857,9 +2836,7 @@ static int ns_ixfr_from_zone(knot_ns_xfr_t *xfr)
 		       knot_strerror(res));
 		knot_response_set_rcode(xfr->response,
 		                           KNOT_RCODE_SERVFAIL);
-		/*! \todo Probably rename the function. */
 		ns_xfr_send_and_clear(xfr, 1);
-//		socket_close(xfr->session);  /*! \todo Remove for UDP.*/
 		rcu_read_unlock();
 		return res;
 	}
@@ -2879,10 +2856,7 @@ static int ns_ixfr_from_zone(knot_ns_xfr_t *xfr)
 	}
 
 	if (res == KNOT_EOK) {
-		/*! \todo Probably rename the function. */
 		ns_xfr_send_and_clear(xfr, 1);
-		//socket_close(xfr->session);  /*! \todo Remove for UDP.*/
-//		return 1;
 	}
 
 	rcu_read_unlock();
@@ -2904,7 +2878,6 @@ static int ns_ixfr(knot_ns_xfr_t *xfr)
 		// malformed packet
 		dbg_ns("IXFR query does not contain authority record.\n");
 		knot_response_set_rcode(xfr->response, KNOT_RCODE_FORMERR);
-		/*! \todo Probably rename the function. */
 		if (ns_xfr_send_and_clear(xfr, 1) == KNOT_ECONN) {
 			return KNOT_ECONN;
 		}
@@ -2922,11 +2895,9 @@ static int ns_ixfr(knot_ns_xfr_t *xfr)
 		// malformed packet
 		dbg_ns("IXFR query is malformed.\n");
 		knot_response_set_rcode(xfr->response, KNOT_RCODE_FORMERR);
-		/*! \todo Probably rename the function. */
 		if (ns_xfr_send_and_clear(xfr, 1) == KNOT_ECONN) {
 			return KNOT_ECONN;
 		}
-		//socket_close(xfr->session);  /*! \todo Remove for UDP. */
 		return KNOT_EMALF;
 	}
 
@@ -2935,8 +2906,7 @@ static int ns_ixfr(knot_ns_xfr_t *xfr)
 
 /*----------------------------------------------------------------------------*/
 
-static int knot_ns_prepare_response(knot_nameserver_t *nameserver,
-                                    knot_packet_t *query, knot_packet_t **resp,
+static int knot_ns_prepare_response(knot_packet_t *query, knot_packet_t **resp,
                                     size_t max_size)
 {
 	assert(max_size >= 500);
@@ -2949,8 +2919,6 @@ static int knot_ns_prepare_response(knot_nameserver_t *nameserver,
 	}
 
 	int ret = knot_packet_set_max_size(*resp, max_size);
-	//(*resp)->wireformat = response_wire;;
-	//(*resp)->max_size = max_size;
 
 	if (ret != KNOT_EOK) {
 		dbg_ns("Failed to init response structure.\n");
@@ -3135,8 +3103,6 @@ void knot_ns_set_nsid(knot_nameserver_t *nameserver, const char *nsid, size_t le
 	
 	int ret = knot_ns_replace_nsid(nameserver->opt_rr, nsid, len);
 
-//	int ret = knot_edns_add_option(nameserver->opt_rr, EDNS_OPTION_NSID,
-//	                               len, (const uint8_t *)nsid);
 	if (ret != KNOT_EOK) {
 		dbg_ns("NS: set_nsid: could not add EDNS option.\n");
 		return;
@@ -3156,11 +3122,9 @@ int knot_ns_parse_packet(const uint8_t *query_wire, size_t qsize,
 	}
 
 	dbg_ns_verb("ns_parse_packet() called with query size %zu.\n", qsize);
-	//dbg_ns_hex((char *)query_wire, qsize);
 
 	// 1) create empty response
 	dbg_ns_verb("Parsing packet...\n");
-	//parsed = knot_response_new_empty(NULL);
 
 	int ret = 0;
 
@@ -3168,7 +3132,6 @@ int knot_ns_parse_packet(const uint8_t *query_wire, size_t qsize,
 	                                         qsize, 1)) != 0) {
 		dbg_ns("Error while parsing packet, "
 		       "libknot error '%s'.\n", knot_strerror(ret));
-//		knot_response_free(&parsed);
 		return KNOT_RCODE_FORMERR;
 	}
 
@@ -3208,8 +3171,6 @@ int knot_ns_parse_packet(const uint8_t *query_wire, size_t qsize,
 		return KNOT_RCODE_NOTIMPL;
 	}
 
-//	knot_packet_free(&packet);
-
 	return KNOT_EOK;
 }
 
@@ -3416,7 +3377,7 @@ int knot_ns_prep_normal_response(knot_nameserver_t *nameserver,
 		resp_max_size = MAX_UDP_PAYLOAD;
 	}
 
-	ret = knot_ns_prepare_response(nameserver, query, resp, resp_max_size);
+	ret = knot_ns_prepare_response(query, resp, resp_max_size);
 	if (ret != KNOT_EOK) {
 		return KNOT_ERROR;
 	}
@@ -3442,7 +3403,6 @@ int knot_ns_prep_normal_response(knot_nameserver_t *nameserver,
 		} else {
 			// copy the DO bit from the query
 			if (knot_query_dnssec_requested(query)) {
-				/*! \todo API for this. */
 				knot_edns_set_do(&(*resp)->opt_rr);
 			}
 		}
@@ -3596,7 +3556,6 @@ dbg_ns_exec_verb(
 		return ret;
 	}
 
-	//int ret = knot_packet_set_max_size(response, xfr->wire_size);
 	response->wireformat = xfr->wire;
 	response->max_size = xfr->wire_size;
 
@@ -3719,7 +3678,6 @@ int knot_ns_xfr_send_error(const knot_nameserver_t *nameserver,
 	/*! \todo Handle TSIG errors differently. */
 	knot_response_set_rcode(xfr->response, rcode);
 	
-	/*! \todo Probably rename the function. */
 	int ret = 0;
 	if ((ret = ns_xfr_send_and_clear(xfr, 1)) != KNOT_EOK
 	    || xfr->response == NULL) {
@@ -3756,10 +3714,10 @@ int knot_ns_answer_axfr(knot_nameserver_t *nameserver, knot_ns_xfr_t *xfr)
 		return ret;
 	}
 	
-	/*!
-	 * \todo [TSIG] The TSIG data should already be stored in 'xfr'.
-	 *       Now just count the expected size of the TSIG RR and save it
-	 *       to the response structure.
+	/*
+	 * The TSIG data should already be stored in 'xfr'.
+	 * Now just count the expected size of the TSIG RR and save it
+	 * to the response structure.
 	 */
 	
 	/*! \todo [TSIG] Get the TSIG size from some API function. */
@@ -3801,9 +3759,6 @@ int knot_ns_answer_ixfr(knot_nameserver_t *nameserver, knot_ns_xfr_t *xfr)
 	    || xfr->response == NULL) {
 		return KNOT_EBADARG;
 	}
-
-	//uint8_t *wire = NULL;
-	//size_t size = xfr->wire_size;
 	
 	// parse rest of the packet (we need the Authority record)
 	int ret = knot_packet_parse_rest(xfr->query);
@@ -3823,11 +3778,11 @@ int knot_ns_answer_ixfr(knot_nameserver_t *nameserver, knot_ns_xfr_t *xfr)
 		return ret;
 	}
 	
-	/*!
-	 * \todo [TSIG] The TSIG data should already be stored in 'xfr'.
-	 *       Now just count the expected size of the TSIG RR and save it
-	 *       to the response structure. This should be optional, only if
-	 *       the request contained TSIG, i.e. if there is the data in 'xfr'.
+	/*
+	 * The TSIG data should already be stored in 'xfr'.
+	 * Now just count the expected size of the TSIG RR and save it
+	 * to the response structure. This should be optional, only if
+	 * the request contained TSIG, i.e. if there is the data in 'xfr'.
 	 */
 	
 	/*! \todo [TSIG] Get the TSIG size from some API function. */
@@ -3846,18 +3801,16 @@ int knot_ns_answer_ixfr(knot_nameserver_t *nameserver, knot_ns_xfr_t *xfr)
 
 int knot_ns_process_axfrin(knot_nameserver_t *nameserver, knot_ns_xfr_t *xfr)
 {
-	/*!
-	 * \todo [TSIG] Here we assume that 'xfr' contains TSIG information
-	 *       and the digest of the query sent to the master or the previous
-	 *       digest.
+	/*
+	 * Here we assume that 'xfr' contains TSIG information
+	 * and the digest of the query sent to the master or the previous
+	 * digest.
 	 */
 	
 	dbg_ns("ns_process_axfrin: incoming packet, wire size: %zu\n",
 	       xfr->wire_size);
 
-	int ret = xfrin_process_axfr_packet(/*xfr->wire, xfr->wire_size,*/
-	                             /*(xfrin_constructed_zone_t **)(&xfr->data)*/
-	                                    xfr);
+	int ret = xfrin_process_axfr_packet(xfr);
 
 	if (ret > 0) { // transfer finished
 		dbg_ns("ns_process_axfrin: AXFR finished, zone created.\n");
@@ -3908,9 +3861,7 @@ dbg_ns_exec_verb(
 );
 	}
 	
-	/*!
-	 * \todo In case of error, shouldn't the zone be destroyed here?
-	 */
+	/*! \todo In case of error, shouldn't the zone be destroyed here? */
 	
 	return ret;
 }
@@ -3976,10 +3927,10 @@ int knot_ns_process_ixfrin(knot_nameserver_t *nameserver,
 {
 	dbg_ns("ns_process_ixfrin: incoming packet\n");
 	
-	/*!
-	 * \todo [TSIG] Here we assume that 'xfr' contains TSIG information
-	 *       and the digest of the query sent to the master or the previous
-	 *       digest.
+	/*
+	 * [TSIG] Here we assume that 'xfr' contains TSIG information
+	 * and the digest of the query sent to the master or the previous
+	 * digest.
 	 */
 
 	int ret = xfrin_process_ixfr_packet(xfr);
@@ -4009,7 +3960,7 @@ int knot_ns_process_ixfrin(knot_nameserver_t *nameserver,
 			dbg_ns("No zone found for incoming IXFR!\n");
 			knot_free_changesets(
 				(knot_changesets_t **)(&xfr->data));
-			return KNOT_ENOZONE;  /*! \todo Other error code? */
+			return KNOT_ENOZONE;
 		}
 		
 		switch (ret) {
@@ -4060,9 +4011,7 @@ int knot_ns_process_ixfrin(knot_nameserver_t *nameserver,
 		}
 	}
 	
-	/*!
-	 * \todo In case of error, shouldn't the zone be destroyed here?
-	 */
+	/*! \todo In case of error, shouldn't the zone be destroyed here? */
 	
 	return ret;
 }
@@ -4078,8 +4027,7 @@ int knot_ns_process_update(knot_nameserver_t *nameserver, knot_packet_t *query,
 
 	knot_packet_t *response;
 	assert(*rsize >= MAX_UDP_PAYLOAD);
-	int ret = knot_ns_prepare_response(nameserver, query, &response,
-	                                   MAX_UDP_PAYLOAD);
+	int ret = knot_ns_prepare_response(query, &response, MAX_UDP_PAYLOAD);
 	if (ret != KNOT_EOK) {
 		knot_ns_error_response_from_query(nameserver, query,
 		                                  KNOT_RCODE_SERVFAIL,
@@ -4117,7 +4065,6 @@ int knot_ns_process_update(knot_nameserver_t *nameserver, knot_packet_t *query,
 	// 2) Find zone for the query
 	// we do not check if there is only one entry in the Question section
 	// because the packet structure does not allow it
-	/*! \todo Check number of Question entries while parsing. */
 	if (knot_packet_qtype(query) != KNOT_RRTYPE_SOA) {
 		dbg_ns("Question is not of type SOA.\n");
 		knot_ns_error_response_full(nameserver, response,
diff --git a/src/libknot/nameserver/name-server.h b/src/libknot/nameserver/name-server.h
index 37833a23217e6b1c11431414d4b0998376f23dd4..b728e66abea604a4d0bca901bfde15d090fb8e33 100644
--- a/src/libknot/nameserver/name-server.h
+++ b/src/libknot/nameserver/name-server.h
@@ -115,8 +115,6 @@ typedef struct knot_ns_xfr {
 	 */
 	uint8_t *tsig_data;
 	size_t tsig_data_size; /*!< Size of the message(s) in bytes */
-//	const knot_rrset_t *tsig; /*!< Response TSIG. 
-//	                            \todo [TSIG] Replace with separate data. */
 	size_t tsig_size;      /*!< Size of the TSIG RR wireformat in bytes.*/
 	knot_key_t *tsig_key;  /*!< Associated TSIG key for signing. */
 	
@@ -127,13 +125,6 @@ typedef struct knot_ns_xfr {
 	uint16_t tsig_rcode;
 	uint64_t tsig_prev_time_signed;
 	
-	/*! \brief Previous digest or request digest. 
-	 *
-	 *  Should be allocated before the transfer (known size).
-	 */
-//	uint8_t *prev_digest;
-//	size_t prev_digest_size; /*!< Size of previous digest in bytes. */
-	
 	/*! 
 	 * \brief Number of the packet currently assembled.
 	 *
diff --git a/src/libknot/packet/packet.c b/src/libknot/packet/packet.c
index 6f5625e358ea57bdfc6c91cc47a283cd04861a45..872876d7812922be48dc466dd8580d55fce45b0b 100644
--- a/src/libknot/packet/packet.c
+++ b/src/libknot/packet/packet.c
@@ -158,8 +158,6 @@ static void knot_packet_init_pointers_query(knot_packet_t *pkt)
 	pkt->question.qname->labels = (uint8_t *)pos;
 	pos += PREALLOC_QNAME_LABELS;
 
-//	pkt->owner_tmp = (uint8_t *)((char *)pkt->question.qname->labels
-//	                              + PREALLOC_QNAME_LABELS);
 
 	// then answer, authority and additional sections
 	if (DEFAULT_ANCOUNT_QUERY == 0) {
@@ -198,10 +196,6 @@ static void knot_packet_init_pointers_query(knot_packet_t *pkt)
 
 	pkt->tmp_rrsets_max = DEFAULT_TMP_RRSETS_QUERY;
 
-//	dbg_packet("End of data: %p (%zu after start of packet)\n",
-//		pkt->tmp_rrsets + DEFAULT_TMP_RRSETS_QUERY,
-//		(void *)(pkt->tmp_rrsets + DEFAULT_TMP_RRSETS_QUERY)
-//		- (void *)pkt);
 	dbg_packet_detail("Allocated total: %u\n", PREALLOC_QUERY);
 
 	assert(pos == (char *)pkt + PREALLOC_QUERY);
@@ -238,10 +232,8 @@ static int knot_packet_parse_header(const uint8_t *wire, size_t *pos,
 	// copy some of the flags: OPCODE and RD
 	// do this by copying flags1 and setting QR to 1, AA to 0 and TC to 0
 	header->flags1 = knot_wire_get_flags1(wire);
-//	knot_wire_flags_set_qr(&header->flags1);
-//	knot_wire_flags_clear_aa(&header->flags1);
-//	knot_wire_flags_clear_tc(&header->flags1);
 	// do not copy flags2 (all set by server)
+
 	header->qdcount = knot_wire_get_qdcount(wire);
 	header->ancount = knot_wire_get_ancount(wire);
 	header->nscount = knot_wire_get_nscount(wire);
@@ -313,10 +305,7 @@ static int knot_packet_parse_question(const uint8_t *wire, size_t *pos,
 
 	*pos = i + 1;
 	question->qtype = knot_wire_read_u16(wire + i + 1);
-	//*pos += 2;
 	question->qclass = knot_wire_read_u16(wire + i + 3);
-	//*pos += 2;
-
 	*pos += 4;
 
 	return KNOT_EOK;
@@ -482,7 +471,6 @@ static int knot_packet_add_rrset(knot_rrset_t *rrset,
                                  const knot_packet_t *packet,
                                  knot_packet_duplicate_handling_t dupl)
 {
-
 	assert(rrset != NULL);
 	assert(rrsets != NULL);
 	assert(rrset_count != NULL);
@@ -770,9 +758,7 @@ int knot_packet_parse_from_wire(knot_packet_t *packet,
 		return KNOT_EMALF;
 	}
 
-	//uint8_t *pos = wireformat;
 	size_t pos = 0;
-	//size_t remaining = size;
 
 	dbg_packet_verb("Parsing wire format of packet (size %zu).\nHeader\n",
 	                size);
diff --git a/src/libknot/packet/query.c b/src/libknot/packet/query.c
index b76059ba982c397ddfdbdf342a5ea4009c998a5b..bc3a4dbd6247baff3f2fa9bc4da9a78f56d23822 100644
--- a/src/libknot/packet/query.c
+++ b/src/libknot/packet/query.c
@@ -209,7 +209,7 @@ int knot_query_add_rrset_authority(knot_packet_t *query,
 	// reserve space for OPT RR
 	/*! \todo Why here??? */
 	endp -= query->opt_rr.size;
-	/*! \note [TSIG] reserve space for TSIG RR */
+	/* Reserve space for TSIG RR */
 	endp -= query->tsig_size;
 	
 	uint8_t *pos = startp;
diff --git a/src/libknot/packet/query.h b/src/libknot/packet/query.h
index a9796414f70949ca1d434e184c5ea1f640d14bcd..cda72b98a3e19205ee212de3a3189ebe7aabeddc 100644
--- a/src/libknot/packet/query.h
+++ b/src/libknot/packet/query.h
@@ -61,12 +61,6 @@ int knot_query_nsid_requested(const knot_packet_t *query);
 
 int knot_query_edns_supported(const knot_packet_t *query);
 
-//int knot_query_set_qname(knot_packet_t *query, const knot_dname_t *qname);
-
-//int knot_query_set_qtype(knot_packet_t *query, uint16_t qtype);
-
-//int knot_query_set_qclass(knot_packet_t *query, uint16_t qclass);
-
 int knot_query_init(knot_packet_t *query);
 
 int knot_query_set_question(knot_packet_t *query,
diff --git a/src/libknot/packet/response.c b/src/libknot/packet/response.c
index 1ff4019f92064c35d0761779b7f798f315e41b0f..bb4d0f2850810e68bc031d434069526c7634fcb9 100644
--- a/src/libknot/packet/response.c
+++ b/src/libknot/packet/response.c
@@ -180,11 +180,6 @@ dbg_response_exec(
 		return KNOT_ENOMEM;
 	}
 
-	// store the position of the name
-//	table->dnames[table->count] = dname;
-//	table->offsets[table->count] = pos;
-//	++table->count;
-
 	/*
 	 * Store positions of ancestors if more than 1 label was not matched.
 	 *
@@ -338,15 +333,9 @@ static int knot_response_compress_dname(const knot_dname_t *dname,
 	knot_compr_t *compr, uint8_t *dname_wire, size_t max, int compr_cs)
 {
 	int size = 0;
-	/*!
-	 * \todo Compress!!
-	 *
-	 * if pos == 0, do not store the position!
-	 */
 
 	// try to find the name or one of its ancestors in the compr. table
 #ifdef COMPRESSION_PEDANTIC
-	//knot_dname_t *to_find = knot_dname_copy(dname);
 	knot_dname_t *to_find = (knot_dname_t *)dname;
 	int copied = 0;
 #else
@@ -645,10 +634,6 @@ dbg_response_exec_verb(
 		return KNOT_EOK;
 	}
 
-	//uint8_t *rrset_wire = (uint8_t *)malloc(PREALLOC_RRSET_WIRE);
-	//short rrset_size = 0;
-
-	//uint8_t *owner_wire = (uint8_t *)malloc(rrset->owner->size);
 	/*
 	 * We may pass the current position to the compression function
 	 * because if the owner will be put somewhere, it will be on the
@@ -658,7 +643,6 @@ dbg_response_exec_verb(
 	 */
 
 	knot_compr_t compr_info;
-	//compr_info.new_entries = 0;
 	compr_info.table = compr;
 	compr_info.wire_pos = wire_pos;
 	compr_info.owner.pos = 0;
@@ -696,9 +680,6 @@ dbg_response_exec_verb(
 		++rrs;
 	} while ((rdata = knot_rrset_rdata_next(rrset, rdata)) != NULL);
 
-	//memcpy(*pos, rrset_wire, rrset_size);
-	//*size += rrset_size;
-	//*pos += rrset_size;
 
 	// the whole RRSet did fit in
 	assert (rrset_size <= max_size);
diff --git a/src/libknot/rdata.c b/src/libknot/rdata.c
index 86d623b72f4043a19c91563ed42b0485bfd001f2..18d4155c22afc596f6c2e974a8cb22919fe9af82 100644
--- a/src/libknot/rdata.c
+++ b/src/libknot/rdata.c
@@ -249,7 +249,6 @@ int knot_rdata_from_wire(knot_rdata_t *rdata, const uint8_t *wire,
 				return KNOT_ERROR;
 			}
 			items[i].dname = dname;
-			//*pos += dname->size;
 			parsed += pos2 - *pos;
 			*pos = pos2;
 			dname = 0;
@@ -309,7 +308,6 @@ int knot_rdata_from_wire(knot_rdata_t *rdata, const uint8_t *wire,
 				break;
 			case 3:
 				pos2 = *pos;
-				//fprintf(stderr, "reading dname from pos: %zu\n", pos2);
 				dname = knot_dname_parse_from_wire(
 					         wire, &pos2, total_size, NULL);
 				if (dname == NULL) {
@@ -331,12 +329,9 @@ int knot_rdata_from_wire(knot_rdata_t *rdata, const uint8_t *wire,
 				memcpy((uint8_t *)(items[i].raw_data + 1),
 				       knot_dname_name(dname),
 				       knot_dname_size(dname));
-				
-//				items[i].dname = dname;
-				//*pos += dname->size;
+
 				parsed += pos2 - *pos;
-				
-				//fprintf(stderr, "read %zu bytes.\n", parsed);
+
 				*pos = pos2;
 				knot_dname_free(&dname);
 				
@@ -374,9 +369,7 @@ int knot_rdata_from_wire(knot_rdata_t *rdata, const uint8_t *wire,
 			memcpy(items[i].raw_data + 1, wire + *pos, item_size);
 			*pos += item_size;
 			parsed += item_size;
-		} else if (item_type == KNOT_RDATA_WF_BINARY/*
-		           || item_type == KNOT_RDATA_WF_IPSECGATEWAY*/) {
-//			fprintf(stderr, "item_size was 0, creating empty rdata item.\n");
+		} else if (item_type == KNOT_RDATA_WF_BINARY) {
 			// in this case we are at the end of the RDATA
 			// and should create an empty RDATA item
 			items[i].raw_data = (uint16_t *)malloc(2);
@@ -389,8 +382,6 @@ int knot_rdata_from_wire(knot_rdata_t *rdata, const uint8_t *wire,
 		} else if (item_type != KNOT_RDATA_WF_COMPRESSED_DNAME
 		           && item_type != KNOT_RDATA_WF_UNCOMPRESSED_DNAME
 		           && item_type != KNOT_RDATA_WF_LITERAL_DNAME) {
-//				fprintf(stderr, "RDATA item not set (i: %d), type: %u"
-//					" RDATA item type: %d\n", i, desc->type ,item_type);
 				assert(0);
 		}
 
@@ -548,126 +539,6 @@ void knot_rdata_deep_free(knot_rdata_t **rdata, uint type,
 	*rdata = NULL;
 }
 
-/*----------------------------------------------------------------------------*/
-/* CLEANUP */
-//uint knot_rdata_wire_size(const knot_rdata_t *rdata,
-//                            const uint8_t *format)
-//{
-//	uint size = 0;
-
-//	for (int i = 0; i < rdata->count; ++i) {
-//		switch (format[i]) {
-//		case KNOT_RDATA_WF_COMPRESSED_DNAME:
-//		case KNOT_RDATA_WF_UNCOMPRESSED_DNAME:
-//		case KNOT_RDATA_WF_LITERAL_DNAME:
-//			size += knot_dname_size(rdata->items[i].dname);
-//			break;
-//		case KNOT_RDATA_WF_BYTE:
-//			size += 1;
-//			break;
-//		case KNOT_RDATA_WF_SHORT:
-//			size += 2;
-//			break;
-//		case KNOT_RDATA_WF_LONG:
-//			size += 4;
-//			break;
-//		case KNOT_RDATA_WF_A:
-//			size += 4;
-//			break;
-//		case KNOT_RDATA_WF_AAAA:
-//			size += 16;
-//			break;
-//		case KNOT_RDATA_WF_BINARY:
-//		case KNOT_RDATA_WF_APL:            // saved as binary
-//		case KNOT_RDATA_WF_IPSECGATEWAY:   // saved as binary
-//			size += rdata->items[i].raw_data[0];
-//			break;
-//		case KNOT_RDATA_WF_TEXT:
-//		case KNOT_RDATA_WF_BINARYWITHLENGTH:
-//			size += rdata->items[i].raw_data[0] + 1;
-//			break;
-//		default:
-//			assert(0);
-//		}
-//	}
-//	return size;
-//}
-
-/*----------------------------------------------------------------------------*/
-
-//int knot_rdata_to_wire(const knot_rdata_t *rdata, const uint8_t *format,
-//                         uint8_t *buffer, uint buf_size)
-//{
-//	uint copied = 0;
-//	uint8_t tmp[KNOT_MAX_RDATA_WIRE_SIZE];
-//	uint8_t *to = tmp;
-
-//	for (int i = 0; i < rdata->count; ++i) {
-//		assert(copied < KNOT_MAX_RDATA_WIRE_SIZE);
-
-//		const uint8_t *from = (uint8_t *)rdata->items[i].raw_data;
-//		uint size = 0;
-
-//		switch (format[i]) {
-//		case KNOT_RDATA_WF_COMPRESSED_DNAME:
-//		case KNOT_RDATA_WF_UNCOMPRESSED_DNAME:
-//		case KNOT_RDATA_WF_LITERAL_DNAME:
-//			size = knot_dname_size(rdata->items[i].dname);
-//			from = knot_dname_name(rdata->items[i].dname);
-
-//			break;
-//		case KNOT_RDATA_WF_BYTE:
-//			size = 1;
-//			break;
-//		case KNOT_RDATA_WF_SHORT:
-//			size = 2;
-//			break;
-//		case KNOT_RDATA_WF_LONG:
-//			size = 4;
-//			break;
-//		case KNOT_RDATA_WF_A:
-//			size = 4;
-//			break;
-//		case KNOT_RDATA_WF_AAAA:
-//			size = 16;
-//			break;
-//		case KNOT_RDATA_WF_TEXT:
-//		case KNOT_RDATA_WF_BINARYWITHLENGTH:
-//			// size stored in the first two bytes, but in little
-//			// endian and we need only the lower byte from it
-//			*to = *from; // lower byte is the first in little endian
-//			to += 1;
-//		case KNOT_RDATA_WF_BINARY:
-//		case KNOT_RDATA_WF_APL:            // saved as binary
-//		case KNOT_RDATA_WF_IPSECGATEWAY:   // saved as binary
-//			// size stored in the first two bytes, those bytes
-//			// must not be copied
-//			size = rdata->items[i].raw_data[0];
-//			from += 2; // skip the first two bytes
-//			break;
-//		default:
-//			assert(0);
-//		}
-
-//		assert(size != 0);
-//		assert(copied + size < KNOT_MAX_RDATA_WIRE_SIZE);
-
-//		memcpy(to, from, size);
-//		to += size;
-//		copied += size;
-//	}
-
-//	if (copied > buf_size) {
-//		dbg_rdata("Not enough place allocated for function "
-//		            "knot_rdata_to_wire(). Allocated %u, need %u\n",
-//		            buf_size, copied);
-//		return -1;
-//	}
-
-//	memcpy(buffer, tmp, copied);
-//	return 0;
-//}
-
 /*----------------------------------------------------------------------------*/
 
 knot_rdata_t *knot_rdata_deep_copy(const knot_rdata_t *rdata, 
diff --git a/src/libknot/rrset.c b/src/libknot/rrset.c
index bc8b81a1e9da11c820cc6602cc519ed635f1c490..c1d6b3dbf0d84c133db911628441d73d05dd73ff 100644
--- a/src/libknot/rrset.c
+++ b/src/libknot/rrset.c
@@ -487,7 +487,6 @@ static int knot_rrset_rr_to_wire(const knot_rrset_t *rrset,
 	*pos += 2;
 
 	size += 10;
-//	compr->wire_pos += size;
 	
 	dbg_rrset_detail("Max size: %zu, size: %d\n", max_size, size);
 
@@ -518,7 +517,6 @@ static int knot_rrset_rr_to_wire(const knot_rrset_t *rrset,
 			                 knot_dname_size(dname));
 			*pos += knot_dname_size(dname);
 			rdlength += knot_dname_size(dname);
-//			compr->wire_pos += dname->size;
 			break;
 		}
 		default: {
@@ -534,7 +532,6 @@ static int knot_rrset_rr_to_wire(const knot_rrset_t *rrset,
 			dbg_rrset_detail("Raw data size: %d\n", raw_data[0]);
 			*pos += raw_data[0];
 			rdlength += raw_data[0];
-//			compr->wire_pos += raw_data[0];
 			break;
 		}
 		}
@@ -635,7 +632,6 @@ int knot_rrset_deep_copy(const knot_rrset_t *from, knot_rrset_t **to)
 	*to = (knot_rrset_t *)calloc(1, sizeof(knot_rrset_t));
 	CHECK_ALLOC_LOG(*to, KNOT_ENOMEM);
 
-	//(*to)->owner = knot_dname_deep_copy(from->owner);
 	(*to)->owner = from->owner;
 	knot_dname_retain((*to)->owner);
 	(*to)->rclass = from->rclass;
@@ -685,6 +681,7 @@ int knot_rrset_shallow_copy(const knot_rrset_t *from, knot_rrset_t **to)
 
 void knot_rrset_rotate(knot_rrset_t *rrset)
 {
+	/*! \todo Maybe implement properly one day. */
 	//rrset->rdata = rrset->rdata->next;
 }
 
@@ -739,10 +736,7 @@ void knot_rrset_deep_free(knot_rrset_t **rrset, int free_owner,
 		                       free_rdata_dnames);
 	}
 
-	/*! \todo Release owner every time? */
-	//if (free_owner) {
-		knot_dname_release((*rrset)->owner);
-	//}
+	knot_dname_release((*rrset)->owner);
 
 	free(*rrset);
 	*rrset = NULL;
diff --git a/src/libknot/tsig-op.c b/src/libknot/tsig-op.c
index 62fb1f39283887118b8e29eea3c3240a8f55997d..72d6f7dd6d30e85f316b466677ab2ce390303fd6 100644
--- a/src/libknot/tsig-op.c
+++ b/src/libknot/tsig-op.c
@@ -95,13 +95,6 @@ static int knot_tsig_compute_digest(const uint8_t *wire, size_t wire_len,
 		return KNOT_TSIG_EBADSIG;
 	}
 
-	/* Create digest, using length of the algorithm. */
-//	*digest = malloc(sizeof(uint8_t) * tsig_alg_digest_length(tsig_alg));
-//	if (!digest) {
-//		ERR_ALLOC_FAILED;
-//		return KNOT_ENOMEM;
-//	}
-
 	/* Decode key from Base64. */
 	char decoded_key[B64BUFSIZE];
 
@@ -114,9 +107,6 @@ static int knot_tsig_compute_digest(const uint8_t *wire, size_t wire_len,
 
 	dbg_tsig_detail("TSIG: decoded key size: %d\n", decoded_key_size);
 	dbg_tsig_detail("TSIG: decoded key: '%*s'\n", decoded_key_size, decoded_key);
-
-//	dbg_tsig_detail("TSIG: using this wire for digest calculation\n");
-//	dbg_tsig_hex_detail(wire, wire_len);
 	dbg_tsig_detail("Wire for signing is %zu bytes long.\n", wire_len);
 
 	/* Compute digest. */
@@ -212,7 +202,6 @@ static int knot_tsig_write_tsig_variables(uint8_t *wire,
 	memcpy(wire + offset, knot_dname_name(tsig_owner),
 	       sizeof(uint8_t) * knot_dname_size(tsig_owner));
 	dbg_tsig_verb("TSIG: write variables: written owner (tsig alg): \n");
-	         /*knot_rrset_class(tsig_rr));*/
 	dbg_tsig_hex_verb(wire + offset, knot_dname_size(tsig_owner));
 	offset += knot_dname_size(tsig_owner);
 
@@ -238,9 +227,6 @@ static int knot_tsig_write_tsig_variables(uint8_t *wire,
 		dbg_tsig("TSIG: write variables: no algorithm name.\n");
 		return KNOT_EBADARG;
 	}
-//	alg_name = knot_dname_new_from_str("HMAC-MD5.SIG-ALG.REG.INT.",
-					   //strlen("HMAC-MD5.SIG-ALG.REG.INT."),
-					   //NULL);
 
 	memcpy(wire + offset, knot_dname_name(alg_name),
 	       sizeof(uint8_t) * knot_dname_size(alg_name));
@@ -309,13 +295,6 @@ static int knot_tsig_create_sign_wire(const uint8_t *msg, size_t msg_len,
 
 	/* Create tmp TSIG. */
 	int ret = KNOT_EOK;
-//	knot_rrset_t *tmp_tsig =
-//		knot_rrset_new(key->name, KNOT_RRTYPE_TSIG, KNOT_CLASS_ANY, 0);
-//	if (!tmp_tsig) {
-//		return KNOT_ENOMEM;
-//	}
-
-//	tsig_rdata_store_current_time(tmp_tsig);
 
 	/*
 	 * Create tmp wire, it should contain message
@@ -352,8 +331,6 @@ static int knot_tsig_create_sign_wire(const uint8_t *msg, size_t msg_len,
 	/* Copy the original message. */
 	dbg_tsig_verb("Copying original message.\n");
 	memcpy(pos, msg, msg_len);
-//	dbg_tsig_detail("TSIG: create wire: original message: \n");
-	//dbg_tsig_hex_detail(pos, msg_len);
 	pos += msg_len;
 	/* Copy TSIG variables. */
 	dbg_tsig_verb("Writing TSIG variables.\n");
@@ -376,20 +353,8 @@ static int knot_tsig_create_sign_wire(const uint8_t *msg, size_t msg_len,
 		return ret;
 	}
 
-//	assert(digest_tmp_len > 0);
 	free(wire);
 
-//	if (digest_tmp_len > *digest_len) {
-//		*digest_len = 0;
-//		return KNOT_ESPACE;
-//	}
-
-//	knot_rrset_deep_free(&tmp_tsig, 1, 1, 1);
-
-	// everything went ok, save the digest to the output parameter
-//	memcpy(digest, digest_tmp, digest_tmp_len);
-//	*digest_len = digest_tmp_len;
-
 	return KNOT_EOK;
 }
 
@@ -436,15 +401,11 @@ static int knot_tsig_create_sign_wire_next(const uint8_t *msg, size_t msg_len,
 	/* Copy the original message. */
 	dbg_tsig_verb("Copying original message.\n");
 	memcpy(wire + prev_mac_len + 2, msg, msg_len);
-//	dbg_tsig_detail("TSIG: create wire: original message: \n");
-	//dbg_tsig_hex_detail(wire + prev_mac_len, msg_len);
 	/* Copy TSIG variables. */
 	
 	dbg_tsig_verb("Writing TSIG timers.\n");
 	ret = knot_tsig_write_tsig_timers(wire + prev_mac_len + msg_len + 2, 
 	                                  tmp_tsig);
-//	ret = knot_tsig_write_tsig_variables(wire + prev_mac_len + msg_len,
-//	                                     tmp_tsig);
 	if (ret != KNOT_EOK) {
 		dbg_tsig("TSIG: create wire: failed to write TSIG "
 		         "timers: %s\n", knot_strerror(ret));
@@ -585,8 +546,6 @@ int knot_tsig_sign(uint8_t *msg, size_t *msg_len,
 	int rr_count = 0;
 	tsig_rdata_set_mac(tmp_tsig, digest_tmp_len, digest_tmp);
 
-	//knot_rrset_dump(tmp_tsig, 1);
-
 	/* Write RRSet to wire */
 	ret = knot_rrset_to_wire(tmp_tsig, msg + *msg_len,
 	                         &tsig_wire_len, &rr_count);
@@ -813,16 +772,9 @@ static int knot_tsig_check_digest(const knot_rrset_t *tsig_rr,
 	/* Calculate the size of TSIG RR. */
 	size_t tsig_len = tsig_wire_actsize(tsig_rr);
 
-//	dbg_tsig_detail("TSIG: check digest: wire before strip: \n");
-	//dbg_tsig_hex_detail(wire, size);
-
 	/* Strip the TSIG. */
 	size -= tsig_len;
 
-//	dbg_tsig_detail("TSIG: check digest: wire after strip (stripped %zu):\n",
-//	                tsig_len);
-	//dbg_tsig_hex_detail(wire, size);
-
 	uint8_t *wire_to_sign = malloc(sizeof(uint8_t) * size);
 	if (!wire_to_sign) {
 		ERR_ALLOC_FAILED;
@@ -861,15 +813,6 @@ static int knot_tsig_check_digest(const knot_rrset_t *tsig_rr,
 		return ret;
 	}
 
-//	uint8_t digest_tmp[KNOT_TSIG_MAX_DIGEST_SIZE];
-//	size_t digest_tmp_len = 0;
-//	ret = knot_tsig_compute_digest(wire, size, digest_tmp,
-//	                               &digest_tmp_len, tsig_key);
-//	if (ret != KNOT_EOK) {
-//		dbg_tsig("TSIG: digest could not be calculated\n");
-//		return ret;
-//	}
-
 	dbg_tsig_verb("TSIG: digest calculated\n");
 
 	/* Compare MAC from TSIG RR RDATA with just computed digest. */
@@ -888,8 +831,6 @@ static int knot_tsig_check_digest(const knot_rrset_t *tsig_rr,
 		return KNOT_TSIG_EBADSIG;
 	}
 
-//	assert(tsig_alg_digest_length(alg) == mac_length);
-
 	dbg_tsig_verb("TSIG: calc digest : ");
 	dbg_tsig_hex_verb(digest_tmp, digest_tmp_len);
 
@@ -932,8 +873,6 @@ int knot_tsig_client_check_next(const knot_rrset_t *tsig_rr,
                                 const knot_key_t *tsig_key,
                                 uint64_t prev_time_signed)
 {
-//	return knot_tsig_client_check(tsig_rr, wire, size, prev_digest,
-//	                              prev_digest_len, tsig_key);
 	dbg_tsig("tsig_client_check_next()\n");
 	return knot_tsig_check_digest(tsig_rr, wire, size, prev_digest,
 	                              prev_digest_len, tsig_key,
diff --git a/src/libknot/tsig.c b/src/libknot/tsig.c
index 4a2c4a35bc897fb89eca102ca5aaab965b09f916..82ba5f81d07c02df38ba27b4ba56b2c355da218d 100644
--- a/src/libknot/tsig.c
+++ b/src/libknot/tsig.c
@@ -342,7 +342,7 @@ tsig_algorithm_t tsig_rdata_alg(const knot_rrset_t *tsig)
 
 uint64_t tsig_rdata_time_signed(const knot_rrset_t *tsig)
 {
-	/*!< \note How about assert. Or maybe change API??? */
+	/*! \note How about assert. Or maybe change API??? */
 	if (!tsig) {
 		return 0;
 	}
@@ -366,7 +366,7 @@ uint64_t tsig_rdata_time_signed(const knot_rrset_t *tsig)
 
 uint16_t tsig_rdata_fudge(const knot_rrset_t *tsig)
 {
-	/*!< \note How about assert. Or maybe change API??? */
+	/*! \note How about assert. Or maybe change API??? */
 	if (!tsig) {
 		return 0;
 	}
@@ -390,7 +390,7 @@ uint16_t tsig_rdata_fudge(const knot_rrset_t *tsig)
 
 const uint8_t *tsig_rdata_mac(const knot_rrset_t *tsig)
 {
-	/*!< \note How about assert. Or maybe change API??? */
+	/*! \note How about assert. Or maybe change API??? */
 	if (!tsig) {
 		return 0;
 	}
@@ -424,7 +424,7 @@ size_t tsig_rdata_mac_length(const knot_rrset_t *tsig)
 
 uint16_t tsig_rdata_orig_id(const knot_rrset_t *tsig)
 {
-	/*!< \note How about assert. Or maybe change API??? */
+	/*! \note How about assert. Or maybe change API??? */
 	if (!tsig) {
 		return 0;
 	}
@@ -448,7 +448,7 @@ uint16_t tsig_rdata_orig_id(const knot_rrset_t *tsig)
 
 uint16_t tsig_rdata_error(const knot_rrset_t *tsig)
 {
-	/*!< \note How about assert. Or maybe change API??? */
+	/*! \note How about assert. Or maybe change API??? */
 	if (!tsig) {
 		return 0;
 	}
@@ -472,7 +472,7 @@ uint16_t tsig_rdata_error(const knot_rrset_t *tsig)
 
 const uint8_t *tsig_rdata_other_data(const knot_rrset_t *tsig)
 {
-	/*!< \note How about assert. Or maybe change API??? */
+	/*! \note How about assert. Or maybe change API??? */
 	if (!tsig) {
 		return 0;
 	}
@@ -491,7 +491,7 @@ const uint8_t *tsig_rdata_other_data(const knot_rrset_t *tsig)
 
 uint16_t tsig_rdata_other_data_length(const knot_rrset_t *tsig)
 {
-	/*!< \note How about assert. Or maybe change API??? */
+	/*! \note How about assert. Or maybe change API??? */
 	if (!tsig) {
 		return 0;
 	}
@@ -587,7 +587,7 @@ int tsig_rdata_store_current_time(knot_rrset_t *tsig)
 		return KNOT_EBADARG;
 	}
 	time_t curr_time = time(NULL);
-	/*!< \todo bleeding eyes. */
+	/*! \todo bleeding eyes. */
 	tsig_rdata_set_time_signed(tsig, (uint64_t)curr_time);
 	return KNOT_EOK;
 }
diff --git a/src/libknot/updates/changesets.c b/src/libknot/updates/changesets.c
index d5e9df3f88c7c9ba78420df24ac001caea6a4c56..457ba93b2a37d6e7605ad31643fc1995c70625ab 100644
--- a/src/libknot/updates/changesets.c
+++ b/src/libknot/updates/changesets.c
@@ -115,11 +115,6 @@ int knot_changeset_add_rr(knot_rrset_t ***rrsets, size_t *count,
 	// try to find the RRSet in the list of RRSets, but search backwards
 	// as it is probable that the last RRSet is the one to which the RR
 	// belongs
-//	int i = *count - 1;
-	
-//	while (i >= 0 && !knot_changeset_rrsets_match((*rrsets)[i], rr)) {
-//		--i;
-//	}
 
 	// Just check the last RRSet. If the RR belongs to it, merge it,
 	// otherwise just add the RR to the end of the list
@@ -136,24 +131,6 @@ int knot_changeset_add_rr(knot_rrset_t ***rrsets, size_t *count,
 	} else {
 		return knot_changeset_add_rrset(rrsets, count, allocated, rr);
 	}
-
-
-
-//	if (i >= 0) {
-//		// found RRSet to merge the new one into
-//		if (knot_rrset_merge((void **)&(*rrsets)[i],
-//		                       (void **)&rr) != KNOT_EOK) {
-//			return KNOT_ERROR;
-//		}
-
-//		// remove the RR
-//		/*! \todo does this make sense? */
-//		knot_rrset_free(&rr); // used to be deep free with all 1's
-
-//		return KNOT_EOK;
-//	} else {
-//		return knot_changeset_add_rrset(rrsets, count, allocated, rr);
-//	}
 }
 
 /*----------------------------------------------------------------------------*/
@@ -261,7 +238,6 @@ int knot_changesets_check_size(knot_changesets_t *changesets)
 
 void knot_free_changeset(knot_changeset_t **changeset)
 {
-	/* XXX XXX investigate wrong frees. */
 	assert((*changeset)->add_allocated >= (*changeset)->add_count);
 	assert((*changeset)->remove_allocated >= (*changeset)->remove_count);
 	assert((*changeset)->allocated >= (*changeset)->size);
@@ -310,7 +286,3 @@ void knot_free_changesets(knot_changesets_t **changesets)
 	free(*changesets);
 	*changesets = NULL;
 }
-
-/*---------------------------------------------------------------------------*/
-
-
diff --git a/src/libknot/updates/changesets.h b/src/libknot/updates/changesets.h
index 0570fc92891dbf48be68c636953f6511270bac1f..e7c56fe2bd457c3b3bafa41c52b84ddab40f15b1 100644
--- a/src/libknot/updates/changesets.h
+++ b/src/libknot/updates/changesets.h
@@ -90,9 +90,9 @@ typedef struct {
 	int new_rdata_count;
 	int new_rdata_allocated;
 
-//	/*!
-//	 * Deleted (without contents) after successful update.
-//	 */
+	/*!
+	 * Deleted (without contents) after successful update.
+	 */
 	knot_node_t **old_nodes;
 	int old_nodes_count;
 	int old_nodes_allocated;
diff --git a/src/libknot/updates/xfr-in.c b/src/libknot/updates/xfr-in.c
index 67dc91499bf60f53662526c8b175ec9745584ee9..669aa9fdf64a25854ba6473b9d39660578339c0f 100644
--- a/src/libknot/updates/xfr-in.c
+++ b/src/libknot/updates/xfr-in.c
@@ -341,7 +341,7 @@ void xfrin_free_orphan_rrsigs(xfrin_orphan_rrsig_t **rrsigs)
 }
 
 /*----------------------------------------------------------------------------*/
-/*! \note [TSIG] */
+
 static int xfrin_check_tsig(knot_packet_t *packet, knot_ns_xfr_t *xfr,
                             int tsig_req)
 {
@@ -400,8 +400,8 @@ static int xfrin_check_tsig(knot_packet_t *packet, knot_ns_xfr_t *xfr,
 			}
 			
 			if (ret != KNOT_EOK) {
-				/*! \note [TSIG] No need to check TSIG error 
-				 *        here, propagate and check elsewhere.*/
+				/* No need to check TSIG error
+				 * here, propagate and check elsewhere.*/
 				knot_rrset_deep_free(&tsig, 1, 1, 1);
 				return ret;
 			}
@@ -425,9 +425,7 @@ static int xfrin_check_tsig(knot_packet_t *packet, knot_ns_xfr_t *xfr,
 			                tsig_rdata_time_signed(tsig);
 
 			
-		}/* else { // TSIG not required and not there
-			
-		}*/
+		}
 	} else if (tsig != NULL) {
 		// TSIG where it should not be
 		knot_rrset_deep_free(&tsig, 1, 1, 1);
@@ -506,10 +504,8 @@ int xfrin_process_axfr_packet(knot_ns_xfr_t *xfr)
 
 	if (*constr == NULL) {
 		// this should be the first packet
-		/*! \note [TSIG] Packet number for checking TSIG validation. */
+		/*! Packet number for checking TSIG validation. */
 		xfr->packet_nr = 0;
-//		/*! \note [TSIG] Storing total size of data for TSIG digest. */
-//		xfr->tsig_data_size = 0;
 		
 		// create new zone
 		/*! \todo Ensure that the packet is the first one. */
@@ -569,7 +565,6 @@ dbg_xfrin_exec(
 		
 		dbg_xfrin_verb("Creating new zone contents.\n");
 		(*constr)->contents = knot_zone_contents_new(node, 0, 1, NULL);
-//		assert(0);
 		if ((*constr)->contents== NULL) {
 			dbg_xfrin("Failed to create new zone.\n");
 			knot_packet_free(&packet);
@@ -585,7 +580,6 @@ dbg_xfrin_exec(
 		assert(zone->apex == node);
 		assert(zone->apex->owner == rr->owner);
 		// add the RRSet to the node
-		//ret = knot_node_add_rrset(node, rr, 0);
 		ret = knot_zone_contents_add_rrset(zone, rr, &node,
 		                                    KNOT_RRSET_DUPL_MERGE, 1);
 		if (ret < 0) {
@@ -599,7 +593,6 @@ dbg_xfrin_exec(
 		} else if (ret > 0) {
 			dbg_xfrin("Merged SOA RRSet.\n");
 			// merged, free the RRSet
-			//knot_rrset_deep_free(&rr, 1, 0, 0);
 			knot_rrset_free(&rr);
 		}
 
@@ -610,20 +603,6 @@ dbg_xfrin_exec(
 		++xfr->packet_nr;
 	}
 	
-	/*! \note [TSIG] add the packet wire size to the data to be verified by 
-	 *               TSIG 
-	 */
-//	if (xfr->tsig_key) {
-//		dbg_xfrin("Adding packet wire to TSIG data (size till now: %zu,"
-//		          " adding: %zu).\n", xfr->tsig_data_size, 
-//		          xfr->wire_size);
-//		assert(KNOT_NS_TSIG_DATA_MAX_SIZE - xfr->tsig_data_size
-//		       >= xfr->wire_size);
-//		memcpy(xfr->tsig_data + xfr->tsig_data_size, xfr->wire, 
-//		       xfr->wire_size);
-//		xfr->tsig_data_size += xfr->wire_size;
-//	}
-	
 	assert(zone != NULL);
 
 	while (ret == KNOT_EOK && rr != NULL) {
@@ -736,7 +715,6 @@ dbg_xfrin_exec_verb(
 			} else if (ret == 2) {
 				// should not happen
 				assert(0);
-//				knot_rrset_deep_free(&rr, 1, 1, 1);
 			} else {
 				assert(node != NULL);
 dbg_xfrin_exec_verb(
@@ -755,7 +733,7 @@ dbg_xfrin_exec_verb(
 			continue;
 		}
 		
-		/*! \note [TSIG] TSIG where it should not be - in Answer section.*/
+		/* TSIG where it should not be - in Answer section.*/
 		if (knot_rrset_type(rr) == KNOT_RRTYPE_TSIG) {
 			// not allowed here
 			dbg_xfrin("TSIG in Answer section.\n");
@@ -809,7 +787,6 @@ dbg_xfrin_exec_verb(
 			} else if (ret > 0) {
 				// should not happen, this is new node
 				assert(0);
-//				knot_rrset_deep_free(&rr, 1, 0, 0);
 			}
 
 			// insert the node into the zone
@@ -837,7 +814,6 @@ dbg_xfrin_exec_verb(
 				return KNOT_ERROR;
 			} else if (ret > 0) {
 				// merged, free the RRSet
-//				knot_rrset_deep_free(&rr, 1, 0, 0);
 				knot_rrset_free(&rr);
 			}
 
@@ -880,9 +856,7 @@ dbg_xfrin_exec_verb(
 		}
 	}
 	
-	/*! \note [TSIG] Now check if there is not a TSIG record at the end of
-	 *               the packet. 
-	 */
+	/* Now check if there is not a TSIG record at the end of the packet. */
 	ret = xfrin_check_tsig(packet, xfr, 
 	                       knot_ns_tsig_required(xfr->packet_nr));
 	++xfr->packet_nr;
@@ -890,7 +864,7 @@ dbg_xfrin_exec_verb(
 	knot_packet_free(&packet);
 	dbg_xfrin_verb("Processed one AXFR packet successfully.\n");
 	
-	/*! \note [TSIG] TSIG errors are propagated and reported in a standard 
+	/* TSIG errors are propagated and reported in a standard
 	 * manner, as we're in response processing, no further error response 
 	 * should be sent. 
 	 */
@@ -1215,9 +1189,6 @@ dbg_xfrin_exec_verb(
 				}
 			}
 			break;
-		// dead code
-//		default:
-//			assert(0);
 		}
 		
 		// parse the next RR
@@ -1371,27 +1342,6 @@ static void xfrin_changes_add_rdata(knot_rdata_t **rdatas, uint *types,
 		return;
 	}
 
-//dbg_xfrin_exec_detail(
-//	// try to find the first RDATA in the given list
-//	for (int i = 0; i < *count; ++i) {
-//		knot_rdata_t *r = rdatas[i];
-//		if (r == NULL) {
-//			continue;
-//		}
-//		while (r != NULL && r->next != rdatas[i]) {
-//			if (r == rdata) {
-//				dbg_xfrin_detail("Found same RDATA: %p\n", rdata);
-//				knot_rdata_dump(rdata, type, 0);
-//			}
-//			r = r->next;
-//		}
-//		if (r == rdata) {
-//			dbg_xfrin_detail("Found same RDATA: %p\n", rdata);
-//			knot_rdata_dump(rdata, type, 0);
-//		}
-//	}
-//);
-
 	rdatas[*count] = rdata;
 	types[*count] = type;
 	++*count;
@@ -1405,7 +1355,6 @@ static void xfrin_zone_contents_free(knot_zone_contents_t **contents)
 	
 	if ((*contents)->table != NULL) {
 		ck_destroy_table(&(*contents)->table, NULL, 0);
-//		ck_table_free(&(*contents)->table);
 	}
 
 	// free the zone tree with nodes
@@ -1454,7 +1403,6 @@ static int xfrin_copy_old_rrset(knot_rrset_t *old, knot_rrset_t **copy,
 {
 	dbg_xfrin_detail("Copying old RRSet: %p\n", old);
 	// create new RRSet by copying the old one
-//	int ret = knot_rrset_shallow_copy(old, copy);
 	int ret = knot_rrset_deep_copy(old, copy);
 	if (ret != KNOT_EOK) {
 		dbg_xfrin("Failed to create RRSet copy.\n");
@@ -1919,9 +1867,6 @@ static knot_node_t *xfrin_add_new_node(knot_zone_contents_t *contents,
 
 	// insert the node into zone structures and create parents if
 	// necessary
-//	dbg_xfrin("Adding new node to zone. From owner: %s type %s\n",
-//	               knot_dname_to_str(node->owner),
-//	               knot_rrtype_to_string(rrset->type));
 	if (is_nsec3) {
 		ret = knot_zone_contents_add_nsec3_node(contents, node, 1, 0,
 		                                        1);
@@ -1993,18 +1938,6 @@ dbg_xfrin_exec_detail(
 			copied = 1;
 		}
 	}
-
-//	if (!*rrset
-//	    || knot_dname_compare(knot_rrset_owner(*rrset),
-//	                          knot_node_owner(node)) != 0
-//	    || knot_rrset_type(*rrset) != knot_rrset_type(add)) {
-//		dbg_xfrin_detail("Removing rrset!\n");
-//		*rrset = knot_node_remove_rrset(node, knot_rrset_type(add));
-//	} else {
-//		dbg_xfrin_verb("Using RRSet from previous iteration.\n");
-//	}
-
-//	*rrset = knot_node_remove_rrset(node, knot_rrset_type(add));
 	
 dbg_xfrin_exec_detail(
 	dbg_xfrin_detail("Removed RRSet: \n");
@@ -2048,17 +1981,6 @@ dbg_xfrin_exec_detail(
 	                 knot_rrtype_to_string(knot_rrset_type(*rrset)));
 	free(name);
 );
-//	knot_rrset_dump(*rrset, 1);
-//	ret = xfrin_copy_old_rrset(old, rrset, changes);
-//	if (ret != KNOT_EOK) {
-//		return ret;
-//	}
-
-//	dbg_xfrin_detail("Copied RRSet: %p\n", *rrset);
-
-//	dbg_xfrin("After copy: Found RRSet with owner %s, type %s\n",
-//	               knot_dname_to_str((*rrset)->owner),
-//	          knot_rrtype_to_string(knot_rrset_type(*rrset)));
 
 	// merge the changeset RRSet to the copy
 	/* What if the update fails?
@@ -2202,7 +2124,6 @@ dbg_xfrin_exec_detail(
 		ret = knot_zone_contents_add_rrsigs(contents, add, rrset, &node,
 		                                    KNOT_RRSET_DUPL_SKIP, 1);
 
-//		ret = knot_rrset_set_rrsigs(*rrset, add);
 		if (ret < 0) {
 			dbg_xfrin("Failed to add RRSIGs to the RRSet.\n");
 			return KNOT_ERROR;
@@ -2228,11 +2149,6 @@ dbg_xfrin_exec_detail(
 				}
 				dbg_xfrin_detail("Copied RRSIGs: %p\n", rrsig);
 			}
-
-//			ret = xfrin_copy_old_rrset(old, &rrsig, changes);
-//			if (ret != KNOT_EOK) {
-//				return ret;
-//			}
 		} else {
 			rrsig = old;
 			dbg_xfrin_verb("Using old RRSIGs: %p\n", rrsig);
@@ -2388,7 +2304,6 @@ static void xfrin_zone_contents_free2(knot_zone_contents_t **contents)
 
 	if ((*contents)->table != NULL) {
 		ck_destroy_table(&(*contents)->table, NULL, 0);
-//		ck_table_free(&(*contents)->table);
 	}
 
 	// free the zone tree, but only the structure
@@ -2881,13 +2796,11 @@ static int xfrin_apply_changeset(knot_zone_contents_t *contents,
 
 	int ret = xfrin_apply_remove(contents, chset, changes);
 	if (ret != KNOT_EOK) {
-//		xfrin_clean_changes_after_fail2(changes);
 		return ret;
 	}
 
 	ret = xfrin_apply_add(contents, chset, changes);
 	if (ret != KNOT_EOK) {
-//		xfrin_clean_changes_after_fail(changes);
 		return ret;
 	}
 
@@ -3226,7 +3139,6 @@ int xfrin_apply_changesets(knot_zone_t *zone,
 		return ret;
 	}
 
-	//xfrin_cleanup_update(&changes);
 	chsets->changes = changes;
 	*new_contents = contents_copy;
 
diff --git a/src/libknot/updates/xfr-in.h b/src/libknot/updates/xfr-in.h
index b009152c583282a924cdccde1ddc25ad8e2a3548..76f42b792b06cb11b801786b45d65158609e2dd8 100644
--- a/src/libknot/updates/xfr-in.h
+++ b/src/libknot/updates/xfr-in.h
@@ -189,9 +189,6 @@ int xfrin_switch_zone(knot_zone_t *zone,
                       knot_zone_contents_t *new_contents,
                       int deep_free);
 
-//void xfrin_cleanup_failed_update(knot_zone_contents_t *old_contents,
-//                                 knot_zone_contents_t **new_contents);
-
 void xfrin_cleanup_successful_update(knot_changes_t **changes);
 
 void xfrin_rollback_update(knot_zone_contents_t *old_contents,
diff --git a/src/libknot/zone/node.c b/src/libknot/zone/node.c
index 6858cc9de3d9b31ee6d0e8994919c2cb29c4a64f..c2a7fcd90d716e2dae04815717f1047b2ce057e2 100644
--- a/src/libknot/zone/node.c
+++ b/src/libknot/zone/node.c
@@ -667,14 +667,6 @@ static void knot_node_free_rrsets_from_tree(void *item, void *data)
 
 void knot_node_free_rrsets(knot_node_t *node, int free_rdata_dnames)
 {
-	/* CLEANUP */
-//	knot_rrset_t **rrsets = knot_node_get_rrsets(node);
-//	for (int i = 0; i < node->rrset_count; i++) {
-//		knot_rrset_deep_free(&(rrsets[i]), 0, 1, free_rdata_dnames);
-//	}
-	
-//	free(rrsets);
-
 	if (node == NULL) {
 		return;
 	}
diff --git a/src/libknot/zone/zone-contents.c b/src/libknot/zone/zone-contents.c
index 59288127bc35ee9c85145327679be235459ea8fe..edecf073fd666df6d0d8066a96f3fc7aaa723709 100644
--- a/src/libknot/zone/zone-contents.c
+++ b/src/libknot/zone/zone-contents.c
@@ -159,11 +159,8 @@ static int knot_zone_contents_dnames_from_rdata_to_table(
 		       == KNOT_RDATA_WF_UNCOMPRESSED_DNAME
 		    || d->wireformat[j]
 		       == KNOT_RDATA_WF_LITERAL_DNAME) {
-//			printf("Saving dname from rdata to dname table: "
-//			         "%p.\n", knot_rdata_get_item(rdata, j)->dname);
 			rc = knot_dname_table_add_dname_check(table,
 					&knot_rdata_get_item(rdata, j)->dname);
-//			printf("Returned: %d\n", rc);
 			if (rc < 0) {
 				dbg_zone("Error: %s\n", knot_strerror(rc));
 				return rc;
@@ -831,31 +828,14 @@ static int knot_zone_contents_find_in_tree(knot_zone_tree_t *tree,
 	assert(previous != NULL);
 
 	knot_node_t *found = NULL, *prev = NULL;
-//	knot_node_t *found2 = NULL, *prev2 = NULL;
 
 	int exact_match = knot_zone_tree_get_less_or_equal(tree, name, &found,
 	                                                   &prev);
 
-//	assert(prev != NULL);
 	assert(exact_match >= 0);
 	*node = found;
 	*previous = prev;
 
-//	if (prev == NULL) {
-//		// either the returned node is the root of the tree, or it is
-//		// the leftmost node in the tree; in both cases node was found
-//		// set the previous node of the found node
-//		assert(exact_match);
-//		assert(found != NULL);
-//		*previous = knot_node_get_previous(found, 1);
-//	} else {
-//		// otherwise check if the previous node is not an empty
-//		// non-terminal
-//		*previous = (knot_node_rrset_count(prev) == 0)
-//		            ? knot_node_get_previous(prev, 1)
-//		            : prev;
-//	}
-
 	return exact_match;
 }
 
@@ -878,7 +858,6 @@ static void knot_zone_contents_node_to_hash(knot_zone_tree_node_t *tnode,
 	 */
 
 #ifdef USE_HASH_TABLE
-	//assert(zone->table != NULL);
 	// add the node also to the hash table if authoritative, or deleg. point
 	if (zone->table != NULL
 	    && ck_insert_item(zone->table,
@@ -1348,7 +1327,6 @@ dbg_zone_exec_detail(
 			assert(knot_node_owner(next_node) == chopped);
 
 			dbg_zone_detail("Inserting new node to zone tree.\n");
-//			TREE_INSERT(zone->tree, knot_node, avl, next_node);
 
 			ret = knot_zone_tree_insert(zone->nodes,
 			                              next_node);
@@ -1763,9 +1741,6 @@ dbg_zone_exec_verb(
 	*removed_hash = ck_remove_item(contents->table, 
 	                               (const char *)knot_dname_name(owner),
 	                               knot_dname_size(owner));
-//	int ret = ck_detete_item(contents->table,
-//	               (const char *)knot_dname_name(owner),
-//	               knot_dname_size(owner), NULL, 0);
 	if (*removed_hash == NULL) {
 		return KNOT_ENONODE;
 	}
@@ -2122,32 +2097,22 @@ dbg_zone_exec_verb(
 
 	// chop leftmost labels until some node is found
 	// copy the name for chopping
-	/* Local allocation, will be discarded. */
-	//knot_dname_t *name_copy = knot_dname_deep_copy(name);
-dbg_zone_exec_detail(
-	//char *n = knot_dname_to_str(name_copy);
+
 	dbg_zone_detail("Finding closest encloser..\nStarting with: %.*s\n",
 	                (int)name_size, name_tmp);
-	//free(n);
-);
 
 	while (item == NULL) {
-		//knot_dname_left_chop_no_copy(name_copy);
 		knot_zone_contents_left_chop(name_tmp, &name_size);
 dbg_zone_exec_detail(
 		dbg_zone_detail("Chopped leftmost label: %.*s\n",
 		               (int)name_size, name_tmp);
 );
 		// not satisfied in root zone!!
-		//assert(name_copy->label_count > 0);
 		assert(name_size > 0);
 
 		item = ck_find_item(zone->table, name_tmp, name_size);
 	}
 
-	/* Directly discard. */
-	//knot_dname_free(&name_copy);
-
 	assert(item != NULL);
 	*closest_encloser = (const knot_node_t *)item->value;
 
@@ -2285,7 +2250,6 @@ int knot_zone_contents_adjust(knot_zone_contents_t *zone)
 	adjust_arg.first_node = NULL;
 	adjust_arg.previous_node = NULL;
 	adjust_arg.err = KNOT_EOK;
-//	adjust_arg.check_ver = check_ver;
 
 	/*
 	 * Adjust the NSEC3 nodes first.
@@ -2396,7 +2360,6 @@ int knot_zone_contents_nsec3_enabled(const knot_zone_contents_t *zone)
 
 	return (zone->nsec3_params.algorithm != 0
 	        && zone->nsec3_nodes->th_root != NULL);
-//	return (zone->nsec3_nodes->th_root != NULL);
 }
 
 /*----------------------------------------------------------------------------*/
@@ -2719,10 +2682,6 @@ int knot_zone_contents_shallow_copy2(const knot_zone_contents_t *from,
 
 	contents->zone = from->zone;
 
-//	/* Initialize NSEC3 params */
-//	memcpy(&contents->nsec3_params, &from->nsec3_params,
-//	       sizeof(knot_nsec3_params_t));
-
 	if ((ret = knot_zone_tree_deep_copy(from->nodes,
 	                                    contents->nodes)) != KNOT_EOK
 	    || (ret = knot_zone_tree_deep_copy(from->nsec3_nodes,
@@ -2879,16 +2838,6 @@ static void knot_zc_integrity_check_previous(const knot_node_t *node,
 			++check_data->errors;
 		}
 
-//		if (knot_node_next(check_data->previous) != node) {
-//			char *name2 = knot_dname_to_str(knot_node_owner(
-//			                 knot_node_next(check_data->previous)));
-//			fprintf(stderr, "Wrong next node: node %s, next %s. "
-//			        "Should be %s.\n", name_prev, name2 ,name);
-//			free(name2);
-
-//			++check_data->errors;
-//		}
-
 		free(name_prev);
 	}
 }
@@ -2971,11 +2920,6 @@ static void knot_zc_integrity_check_parent(const knot_node_t *node,
 	    && knot_dname_matched_labels(node_owner, parent_owner)
 	       == knot_dname_label_count(parent_owner)) {
 
-//		// increase the parent's children count
-//		fprintf(stderr, "Parent: %s, node: %s. Increasing children count.\n",
-//		       pname, name);
-//		++check_data->children;
-
 		// check the parent pointer
 		const knot_node_t *parent = knot_node_parent(node);
 		if (parent != check_data->parent) {
@@ -3014,22 +2958,6 @@ static void knot_zc_integrity_check_parent(const knot_node_t *node,
 				++check_data->errors;
 			}
 		}
-	} else {
-		// not a direct child, check children count
-//		if (check_data->parent
-//		    && knot_node_children(check_data->parent)
-//		       != check_data->children) {
-//			fprintf(stderr, "Wrong children count: node %s, count: "
-//			        "%u. Should be: %u\n", pname,
-//			        knot_node_children(check_data->parent),
-//			        check_data->children);
-
-//			++check_data->errors;
-//		}
-
-		// reset the children count
-		//check_data->parent = node;
-//		check_data->children = 0;
 	}
 
 	free(pname);
@@ -3086,15 +3014,6 @@ static int knot_zc_integrity_check_find_dname(const knot_zone_contents_t *zone,
                                               const char *node_name)
 {
 	int ret = 0;
-
-//	find_dname_data_t data_find;
-//	data_find.found = NULL;
-//	data_find.to_find = to_find;
-
-//	int res = knot_zone_contents_dname_table_apply(
-//	                        (knot_zone_contents_t *)zone,
-//	                        find_in_dname_table, (void *)&data_find);
-//	assert(res == KNOT_EOK);
 	
 	knot_dname_t *found = knot_dname_table_find_dname(zone->dname_table, 
 	                                               (knot_dname_t *)to_find);
@@ -3340,27 +3259,12 @@ static void reset_new_nodes(knot_zone_tree_node_t *tree_node, void *data)
 
 /*----------------------------------------------------------------------------*/
 
-/*!< \todo remove debug code. */
-//static void print_child_count(knot_node_t *node, void *data)
-//{
-//	UNUSED(data);
-//	assert(node != NULL);
-
-//	char *name = knot_dname_to_str(knot_node_owner(node));
-//	fprintf(stderr, "Node: %s, children count: %d\n", name,
-//	        knot_node_children(node));
-//	free(name);
-//}
-
-/*----------------------------------------------------------------------------*/
-
 static void count_nsec3_nodes(knot_zone_tree_node_t *tree_node, void *data)
 {
 	assert(tree_node != NULL);
 	assert(tree_node->node != NULL);
 	assert(data != NULL);
 
-//	int *count = (int *)data;
 	knot_node_t *apex = (knot_node_t *)data;
 	assert(apex != NULL);
 	
@@ -3382,10 +3286,6 @@ int knot_zc_integrity_check_child_count(check_data_t *data)
 
 	knot_zone_tree_init(nodes_copy);
 
-//	int ret = knot_zone_contents_tree_apply_inorder(data->contents,
-//	                                                print_child_count,
-//	                                                NULL);
-
 	int ret = knot_zone_tree_deep_copy(data->contents->nodes, nodes_copy);
 	assert(ret == KNOT_EOK);
 
@@ -3401,7 +3301,6 @@ int knot_zc_integrity_check_child_count(check_data_t *data)
 	knot_zone_tree_forward_apply_inorder(nodes_copy, count_children, NULL);
 
 	// add count of NSEC3 nodes to the apex' children count
-//	int nsec3_nodes = 0;
 	fprintf(stderr, "Children count of new apex before NSEC3: %d\n",
 	        data->contents->apex->new_node->children);
 	knot_zone_tree_forward_apply_inorder(data->contents->nsec3_nodes,
@@ -3411,7 +3310,6 @@ int knot_zc_integrity_check_child_count(check_data_t *data)
 
 	// now compare the children counts
 	// iterate over the old zone and search for nodes in the copy
-//	data->children = nsec3_nodes;
 	knot_zone_tree_forward_apply_inorder(nodes_copy, check_child_count,
 	                                     (void *)data);
 
diff --git a/src/libknot/zone/zone-contents.h b/src/libknot/zone/zone-contents.h
index 3143ef9aee961ee504ad7ed3e65e10749a28f3ab..0c9567bf2e39de08b8467213837286393d3ab7cd 100644
--- a/src/libknot/zone/zone-contents.h
+++ b/src/libknot/zone/zone-contents.h
@@ -55,7 +55,7 @@ typedef struct knot_zone_contents_t {
 
 	knot_nsec3_params_t nsec3_params;
 	
-  /*!
+	/*!
 	 * \todo Unify the use of this field - authoritative nodes vs. all.
 	 */
 	uint node_count;
@@ -84,13 +84,10 @@ knot_zone_contents_t *knot_zone_contents_new(knot_node_t *apex,
                                                  int use_domain_table,
                                                  struct knot_zone *zone);
 
-//short knot_zone_contents_generation(const knot_zone_contents_t *contents);
-
 int knot_zone_contents_gen_is_old(const knot_zone_contents_t *contents);
 int knot_zone_contents_gen_is_new(const knot_zone_contents_t *contents);
 int knot_zone_contents_gen_is_finished(const knot_zone_contents_t *contents);
 
-//void knot_zone_contents_switch_generation(knot_zone_contents_t *contents);
 
 void knot_zone_contents_set_gen_old(knot_zone_contents_t *contents);
 void knot_zone_contents_set_gen_new(knot_zone_contents_t *contents);
@@ -187,9 +184,6 @@ int knot_zone_contents_remove_node(knot_zone_contents_t *contents,
 	const knot_node_t *node, knot_zone_tree_node_t **removed_tree, 
 	ck_hash_table_item_t **removed_hash);
 
-//knot_zone_tree_node_t *knot_zone_contents_remove_node(
-//	knot_zone_contents_t *contents, const knot_node_t *node);
-
 int knot_zone_contents_remove_nsec3_node(knot_zone_contents_t *contents, 
 	const knot_node_t *node, knot_zone_tree_node_t **removed);
 
@@ -357,9 +351,6 @@ const knot_node_t *knot_zone_contents_apex(
 knot_node_t *knot_zone_contents_get_apex(
 	const knot_zone_contents_t *contents);
 
-//knot_dname_t *knot_zone_contents_name(
-//	const knot_zone_contents_t *contents);
-
 /*!
  * \brief Optimizes zone by replacing domain names in RDATA with references to
  *        domain names present in zone (as node owners).
@@ -555,12 +546,6 @@ int knot_zone_contents_shallow_copy(const knot_zone_contents_t *from,
 int knot_zone_contents_shallow_copy2(const knot_zone_contents_t *from,
                                      knot_zone_contents_t **to);
 
-//int knot_zone_contents_dnames_from_node_to_table(
-//	knot_dname_table_t *table, knot_node_t *node);
-
-//void knot_zone_contents_adjust_node(knot_node_t *node,
-//                                    knot_zone_contents_t *zone, int check_ver);
-
 void knot_zone_contents_free(knot_zone_contents_t **contents);
 
 void knot_zone_contents_deep_free(knot_zone_contents_t **contents,
diff --git a/src/libknot/zone/zone-tree.c b/src/libknot/zone/zone-tree.c
index 2b79f86f5933ef868e6351a2993ee7f5819d484a..a0555cd92fd14413ad28c20bea54699aac0ba02c 100644
--- a/src/libknot/zone/zone-tree.c
+++ b/src/libknot/zone/zone-tree.c
@@ -132,8 +132,7 @@ static int knot_zone_tree_deep_copy_node(knot_zone_tree_node_t *from,
 	}
 
 	int ret = knot_node_shallow_copy(from->node, &(*to)->node);
-//	printf("Copied node: %p to node %p. New node1: %p, new node 2: %p\n",
-//	       from->node, (*to)->node, from->node->new_node, (*to)->node->new_node);
+
 	if (ret != KNOT_EOK) {
 		dbg_zone_verb("Failed to do shallow copy of node.\n");
 		free(*to);
@@ -402,8 +401,6 @@ int knot_zone_tree_remove(knot_zone_tree_t *tree,
 	knot_node_free(&tmp_data, 0);
 	free(tmp);
 
-//	*removed = (n) ? n->node : NULL;
-//	free(n);
 	*removed = n;
 	
 	return KNOT_EOK;
diff --git a/src/libknot/zone/zone-tree.h b/src/libknot/zone/zone-tree.h
index ca65fe608fa5f48d5605231ac69e01fceede1a87..95b4e2310cbaf53552acf727ba57f555255aa239 100644
--- a/src/libknot/zone/zone-tree.h
+++ b/src/libknot/zone/zone-tree.h
@@ -39,8 +39,6 @@ typedef struct knot_zone_tree_node {
 	TREE_ENTRY(knot_zone_tree_node) avl;
 	/*! \brief Zone tree data. */
 	knot_node_t *node;
-	/*! \brief Owner of the node. */
-//	knot_dname_t *owner;
 } knot_zone_tree_node_t;
 
 /*----------------------------------------------------------------------------*/
diff --git a/src/libknot/zone/zone.h b/src/libknot/zone/zone.h
index 331ef1f4df295bc5e873adb0eb8ff31a7de6ede1..d1bd7c3b77b54c8dac8673ccb44a3ad5228b3381 100644
--- a/src/libknot/zone/zone.h
+++ b/src/libknot/zone/zone.h
@@ -40,11 +40,6 @@
 
 #include "zone/zone-contents.h"
 
-/*----------------------------------------------------------------------------*/
-
-//typedef TREE_HEAD(avl_tree, knot_node) avl_tree_t;
-//struct event_t;
-
 /*----------------------------------------------------------------------------*/
 /*!
  * \brief Return values for search functions.
diff --git a/src/libknot/zone/zonedb.c b/src/libknot/zone/zonedb.c
index 1606d9367d0f6158969665dba167a1a6ef010b7a..ac176d7f68dff31a440b4ee32231e4452d313d26 100644
--- a/src/libknot/zone/zonedb.c
+++ b/src/libknot/zone/zonedb.c
@@ -135,14 +135,8 @@ knot_zone_t *knot_zonedb_remove_zone(knot_zonedb_t *db,
 	// remove the zone from the skip list, but do not destroy it
 	gen_tree_remove(db->zone_tree, &dummy_zone);
 
-//	if (destroy_zone) {
-//		// properly destroy the zone and all its contents
-//		knot_zone_deep_free(&z, 0);
-//	}
-
 	db->zone_count--;
 
-	//return KNOT_EOK;
 	return z;
 }
 
@@ -168,11 +162,7 @@ const knot_zone_t *knot_zonedb_find_zone_for_name(knot_zonedb_t *db,
 	knot_zone_t dummy_zone;
 	dummy_zone.name = knot_dname_deep_copy(dname);
 	void *found = NULL;
-	
-//	int exact_match = gen_tree_find_less_or_equal(db->zone_tree,
-//	                                              &dummy_zone,
-//	                                              &found);
-//	UNUSED(exact_match);
+
 	found = gen_tree_find(db->zone_tree, &dummy_zone);
 	while (found == NULL && knot_dname_label_count(dummy_zone.name) > 0) {
 		knot_dname_left_chop_no_copy(dummy_zone.name);
diff --git a/src/libknot/zone/zonedb.h b/src/libknot/zone/zonedb.h
index d5a49926f55ed2f5d955c00b70b7accd319c5cd4..81326bfb1e16825ab68ce50ae71097caf3e7c23d 100644
--- a/src/libknot/zone/zonedb.h
+++ b/src/libknot/zone/zonedb.h
@@ -85,9 +85,6 @@ int knot_zonedb_add_zone(knot_zonedb_t *db, knot_zone_t *zone);
 knot_zone_t * knot_zonedb_remove_zone(knot_zonedb_t *db, 
                                       const knot_dname_t *zone_name);
 
-//knot_zone_t *knot_zonedb_replace_zone(knot_zonedb_t *db,
-//                                          knot_zone_t *zone);
-
 /*!
  * \brief Finds zone exactly matching the given zone name.
  *