diff --git a/Knot.files b/Knot.files
index 4190a021556fc9fb3f12f962a2b2a8091baf6e46..297a84ce968195984df30fba288d94676249ec97 100644
--- a/Knot.files
+++ b/Knot.files
@@ -88,7 +88,6 @@ src/common/slab/slab.c
 src/common/slab/slab.h
 src/common/sockaddr.c
 src/common/sockaddr.h
-src/knot/common.h
 src/knot/conf/cf-lex.l
 src/knot/conf/cf-parse.y
 src/knot/conf/conf.c
@@ -104,6 +103,7 @@ src/knot/ctl/process.c
 src/knot/ctl/process.h
 src/knot/ctl/remote.c
 src/knot/ctl/remote.h
+src/knot/knot.h
 src/knot/main.c
 src/knot/other/debug.h
 src/knot/server/dthreads.c
@@ -201,6 +201,7 @@ src/libknot/zone/zone.c
 src/libknot/zone/zone.h
 src/libknot/zone/zonedb.c
 src/libknot/zone/zonedb.h
+src/tests/Makefile.am
 src/tests/common/acl_tests.c
 src/tests/common/acl_tests.h
 src/tests/common/base32hex_tests.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 370cb5855cda68d439d6e4251ffce2a034644a16..141856ade0cd19edf81405089fa0af572e34eb5a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -242,8 +242,7 @@ libknotd_la_SOURCES =				\
 	knot/stat/gatherer.h			\
 	knot/stat/stat.h			\
 	knot/stat/stat-common.h			\
-	knot/common.h				\
-	common/latency.h			\
+	knot/knot.h				\
 	knot/other/debug.h			\
 	knot/conf/cf-lex.l			\
 	knot/conf/cf-parse.y			\
diff --git a/src/common/log.c b/src/common/log.c
index 8755ae2af79d47076ff3c579c8e8a809183a6813..2301e19f969b43bfab435668e52e18b60d008a93 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -25,7 +25,6 @@
 
 #include "common/log.h"
 #include "common/lists.h"
-#include "knot/common.h"
 #include "knot/conf/conf.h"
 
 /*! Log source table. */
diff --git a/src/knot/conf/conf.c b/src/knot/conf/conf.c
index 36fcbbfec00c4aa1a2a14a380863894a3f572393..c93b8ea029a4e20e014e5acaad4ebd06ae779f90 100644
--- a/src/knot/conf/conf.c
+++ b/src/knot/conf/conf.c
@@ -28,7 +28,7 @@
 #include <urcu.h>
 #include "knot/conf/conf.h"
 #include "knot/conf/extra.h"
-#include "knot/common.h"
+#include "knot/knot.h"
 #include "knot/ctl/remote.h"
 
 /*
diff --git a/src/knot/conf/logconf.c b/src/knot/conf/logconf.c
index 273a5979952eeb675024e42cbe4965ff248484cd..427e76272bf67d96a0cc930e1be5371ec7a9f933 100644
--- a/src/knot/conf/logconf.c
+++ b/src/knot/conf/logconf.c
@@ -26,7 +26,7 @@
 #include "knot/conf/conf.h"
 #include "common/log.h"
 #include "common/lists.h"
-#include "knot/common.h"
+#include "knot/knot.h"
 
 int log_conf_hook(const struct conf_t *conf, void *data)
 {
diff --git a/src/knot/ctl/knotc_main.c b/src/knot/ctl/knotc_main.c
index 0512b283b80163de8ef73193d21bfd7b416570ef..3f6517a48c7eee33f86b47a054f25bbc95fc969a 100644
--- a/src/knot/ctl/knotc_main.c
+++ b/src/knot/ctl/knotc_main.c
@@ -32,7 +32,7 @@
 #include <sys/wait.h>
 #endif
 
-#include "knot/common.h"
+#include "knot/knot.h"
 #include "common/descriptor.h"
 #include "knot/ctl/process.h"
 #include "knot/ctl/remote.h"
diff --git a/src/knot/ctl/process.c b/src/knot/ctl/process.c
index a4d4ecb20f9b8a5e281684770273231262ab81cf..2c622aa1e1e2fe269a72303ebd97c9a883f3ed6d 100644
--- a/src/knot/ctl/process.c
+++ b/src/knot/ctl/process.c
@@ -27,7 +27,7 @@
 #include <sys/wait.h>
 #include <sys/stat.h>
 
-#include "knot/common.h"
+#include "knot/knot.h"
 #include "knot/ctl/process.h"
 #include "knot/conf/conf.h"
 #include "common/mempattern.h"
diff --git a/src/knot/ctl/remote.c b/src/knot/ctl/remote.c
index fca8e32d2f18f4010dc3910409bee94eedd436b6..9f39e6ac5485fe202f4de80653f041c9f9e10e55 100644
--- a/src/knot/ctl/remote.c
+++ b/src/knot/ctl/remote.c
@@ -19,7 +19,7 @@
 #include "common/log.h"
 #include "common/fdset.h"
 #include "common/prng.h"
-#include "knot/common.h"
+#include "knot/knot.h"
 #include "knot/conf/conf.h"
 #include "knot/server/socket.h"
 #include "knot/server/tcp-handler.h"
diff --git a/src/knot/common.h b/src/knot/knot.h
similarity index 64%
rename from src/knot/common.h
rename to src/knot/knot.h
index 9e31fcfaa8efcfcb8363cbb10974727bbfc69a88..fb0f9fdc0c0f9af517c71bf38c48ba81931c2bc2 100644
--- a/src/knot/common.h
+++ b/src/knot/knot.h
@@ -14,18 +14,18 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 /*!
- * \file src/knot/common.h
+ * \file knot.h
  *
  * \author Lubos Slovak <lubos.slovak@nic.cz>
  *
  * \brief Common macros, includes and utilities.
  *
- * \addtogroup utils
+ * \addtogroup server
  * @{
  */
 
-#ifndef _KNOTD_COMMON_H_
-#define _KNOTD_COMMON_H_
+#ifndef _KNOTD_KNOT_H_
+#define _KNOTD_KNOT_H_
 
 #include <signal.h>
 #include <stdint.h>
@@ -34,11 +34,6 @@
  * Common types and constants.
  */
 
-#ifndef UINT_DEFINED
-typedef unsigned int uint; /*!< \brief Unsigned. */
-#define UINT_DEFINED
-#endif
-
 #define PROJECT_EXENAME "knotd"
 #define PROJECT_EXEC SBINDIR "/" PROJECT_EXENAME /*!< \brief  Project executable. */
 #define PID_FILE "knot.pid" /*!< \brief Server PID file name. */
@@ -60,50 +55,11 @@ typedef unsigned int uint; /*!< \brief Unsigned. */
  * Common includes.
  */
 
-#include "common/latency.h"
 #include "common/print.h"
 #include "common/log.h"
 #include "common/errcode.h"
 #include "knot/other/debug.h"
 
-/*! \brief Eliminate compiler warning with unused parameters. */
-#define UNUSED(param) (void)(param)
-
-/* Optimisation macros. */
-#ifndef knot_likely
-/*! \brief Optimize for x to be true value. */
-#define knot_likely(x)       __builtin_expect((x),1)
-#endif
-#ifndef knot_unlikely
-/*! \brief Optimize for x to be false value. */
-#define knot_unlikely(x)     __builtin_expect((x),0)
-#endif
-
-/*! \todo Refactor theese. We should have an allocator function handling this.*/
-#ifndef ERR_ALLOC_FAILED
-#define ERR_ALLOC_FAILED fprintf(stderr, "Allocation failed at %s:%d (%s)\n", \
-				 __FILE__, __LINE__, PACKAGE_STRING)
-#endif
-
-#ifndef CHECK_ALLOC_LOG
-#define CHECK_ALLOC_LOG(var, ret) \
-	do { \
-		if ((var) == NULL) { \
-			ERR_ALLOC_FAILED; \
-			return (ret); \
-		} \
-	} while (0)
-#endif
-
-#ifndef CHECK_ALLOC
-#define CHECK_ALLOC(var, ret) \
-	do { \
-		if ((var) == NULL) { \
-			return (ret); \
-		} \
-	} while (0)
-#endif
-
 /* Workarounds for clock_gettime() not available on some platforms. */
 #ifdef HAVE_CLOCK_GETTIME
 #define time_now(x) clock_gettime(CLOCK_MONOTONIC, (x))
@@ -115,6 +71,6 @@ typedef struct timeval timev_t;
 #error Neither clock_gettime() nor gettimeofday() found. At least one is required.
 #endif
 
-#endif /* _KNOTD_COMMON_H_ */
+#endif /* _KNOTD_KNOT_H_ */
 
 /*! @} */
diff --git a/src/knot/main.c b/src/knot/main.c
index ec719d89aa73543944c12921027591c73d926a7d..930a2d67c895b0c2c55a0929dc70c6f445599e56 100644
--- a/src/knot/main.c
+++ b/src/knot/main.c
@@ -27,7 +27,7 @@
 
 #include "common.h"
 #include "common/evqueue.h"
-#include "knot/common.h"
+#include "knot/knot.h"
 #include "knot/server/server.h"
 #include "knot/ctl/process.h"
 #include "knot/ctl/remote.h"
diff --git a/src/knot/server/dthreads.c b/src/knot/server/dthreads.c
index f4b76aa008f12893177cb6d3ff00b548b97bfe95..759faf23348fd818ecd94d9ec9bf197ea32d7db1 100644
--- a/src/knot/server/dthreads.c
+++ b/src/knot/server/dthreads.c
@@ -30,7 +30,7 @@
 #include <pthread_np.h>
 #endif /* HAVE_PTHREAD_NP_H */
 
-#include "knot/common.h"
+#include "knot/knot.h"
 #include "knot/server/dthreads.h"
 #include "common/log.h"
 
diff --git a/src/knot/server/rrl.c b/src/knot/server/rrl.c
index bd7c6676d7479605b7da78ea7ee8cd3d14dba025..f064d8fd87738c3b312905c877e9fab2940663d7 100644
--- a/src/knot/server/rrl.c
+++ b/src/knot/server/rrl.c
@@ -22,7 +22,7 @@
 #include <assert.h>
 
 #include "knot/server/rrl.h"
-#include "knot/common.h"
+#include "knot/knot.h"
 #include "libknot/consts.h"
 #include "libknot/util/wire.h"
 #include "common/hattrie/murmurhash3.h"
diff --git a/src/knot/server/server.c b/src/knot/server/server.c
index b0e963fcc16aeab333df9d30d97755bd0320f7f3..f6f8ec9674fbee0cd53d11d3750290af541c8f93 100644
--- a/src/knot/server/server.c
+++ b/src/knot/server/server.c
@@ -24,7 +24,7 @@
 #include <assert.h>
 
 #include "common/prng.h"
-#include "knot/common.h"
+#include "knot/knot.h"
 #include "knot/server/server.h"
 #include "knot/server/udp-handler.h"
 #include "knot/server/tcp-handler.h"
diff --git a/src/knot/server/server.h b/src/knot/server/server.h
index cb5ab1a5777ae4ef4058b50086032f85e1985790..84a32e3f531eae025be934f7deca62866610fdf4 100644
--- a/src/knot/server/server.h
+++ b/src/knot/server/server.h
@@ -36,7 +36,6 @@
 #ifndef _KNOTD_SERVER_H_
 #define _KNOTD_SERVER_H_
 
-#include "knot/common.h"
 #include "libknot/nameserver/name-server.h"
 #include "knot/server/xfr-handler.h"
 #include "knot/server/socket.h"
diff --git a/src/knot/server/socket.c b/src/knot/server/socket.c
index c97015e429e21cdb8f1cae46103e27f3f7571b4f..9b5f2ff72b434201e6964833ec63963c30a63497 100644
--- a/src/knot/server/socket.c
+++ b/src/knot/server/socket.c
@@ -32,7 +32,7 @@
 #include <netinet/ip.h>
 #include <arpa/inet.h>
 
-#include "knot/common.h"
+#include "knot/knot.h"
 #include "knot/server/socket.h"
 
 int socket_create(int family, int type, int proto)
diff --git a/src/knot/server/tcp-handler.c b/src/knot/server/tcp-handler.c
index af06b36d01573d982e047fc78bd9ede793990477..f8fe90bb4caa14c36d5f641e376b287aa8677465 100644
--- a/src/knot/server/tcp-handler.c
+++ b/src/knot/server/tcp-handler.c
@@ -32,7 +32,7 @@
 #include "common/sockaddr.h"
 #include "common/skip-list.h"
 #include "common/fdset.h"
-#include "knot/common.h"
+#include "knot/knot.h"
 #include "knot/server/tcp-handler.h"
 #include "knot/server/xfr-handler.h"
 #include "knot/server/zones.h"
diff --git a/src/knot/server/udp-handler.c b/src/knot/server/udp-handler.c
index 3ed57c5b8e36a2475fe4fd9b2ebf59443897030a..63358e9aabe9ebb836ead99dfb1314fc90a385d9 100644
--- a/src/knot/server/udp-handler.c
+++ b/src/knot/server/udp-handler.c
@@ -41,7 +41,7 @@
 #include "common/sockaddr.h"
 #include "common/mempattern.h"
 #include "common/mempool.h"
-#include "knot/common.h"
+#include "knot/knot.h"
 #include "knot/server/udp-handler.h"
 #include "libknot/nameserver/name-server.h"
 #include "knot/stat/stat.h"
diff --git a/src/knot/server/xfr-handler.c b/src/knot/server/xfr-handler.c
index 9d024480952536886365e0bd4d2105f4f9f85e11..114fc714ec9ab1fdee307bc0a705bfe459af72ec 100644
--- a/src/knot/server/xfr-handler.c
+++ b/src/knot/server/xfr-handler.c
@@ -28,7 +28,7 @@
 #include <assert.h>
 #include <urcu.h>
 
-#include "knot/common.h"
+#include "knot/knot.h"
 #include "knot/server/xfr-handler.h"
 #include "libknot/nameserver/name-server.h"
 #include "knot/server/socket.h"
diff --git a/src/knot/zone/semantic-check.c b/src/knot/zone/semantic-check.c
index 44374c9f87ec4b42a2b78cf170ea040b15bd5980..5446b83e6e2faadcd3307a6a41ffc923070e984e 100644
--- a/src/knot/zone/semantic-check.c
+++ b/src/knot/zone/semantic-check.c
@@ -22,7 +22,7 @@
 #include <netinet/in.h>	
 #include <arpa/inet.h>
 
-#include "knot/common.h"
+#include "knot/knot.h"
 #include "knot/other/debug.h"
 #include "libknot/libknot.h"
 #include "libknot/sign/key.h"
diff --git a/src/libknot/common.h b/src/libknot/common.h
index b5bb956150ad9ee0218142939cc5b570e174d66b..75acc7bd60081350703f8b091d0aebc79933cc37 100644
--- a/src/libknot/common.h
+++ b/src/libknot/common.h
@@ -41,7 +41,7 @@ typedef unsigned int uint; /*!< \brief Unsigned. */
 /*! \brief Eliminate compiler warning with unused parameters. */
 #define UNUSED(param) (void)(param)
 
-#if 0 // Disabled due to a conflict with system MIN and MAX on BSDs.
+#ifndef MIN
 /*! \brief Type-safe minimum macro. */
 #define MIN(a, b) \
 	({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; })
@@ -61,20 +61,11 @@ typedef unsigned int uint; /*!< \brief Unsigned. */
 #define knot_unlikely(x)     __builtin_expect((x),0)
 #endif
 
-/* Optimisation macros. */
-#ifndef knot_likely
-/*! \brief Optimize for x to be true value. */
-#define knot_likely(x)       __builtin_expect((x),1)
-#endif
-#ifndef knot_unlikely
-/*! \brief Optimize for x to be false value. */
-#define knot_unlikely(x)     __builtin_expect((x),0)
-#endif
-
 /*! \todo Refactor theese. We should have an allocator function handling this.*/
 #ifndef ERR_ALLOC_FAILED
-#define ERR_ALLOC_FAILED fprintf(stderr, "Allocation failed at %s:%d (%s ver.%s)\n", \
-				 __FILE__, __LINE__, KNOT_NAME, KNOT_VER)
+#define ERR_ALLOC_FAILED fprintf(stderr, \
+                                 "Allocation failed at %s:%d (%s ver.%s)\n", \
+                                 __FILE__, __LINE__, KNOT_NAME, KNOT_VER)
 #endif
 
 #ifndef CHECK_ALLOC_LOG
diff --git a/src/tests/common/slab_tests.c b/src/tests/common/slab_tests.c
index ad2eee13570114c0be2e5a8688cbe306103ac6dc..088370d35e0289a8e05de0a1ba052156d2a7198a 100644
--- a/src/tests/common/slab_tests.c
+++ b/src/tests/common/slab_tests.c
@@ -22,7 +22,6 @@
 
 #include "tests/common/slab_tests.h"
 #include "common/slab/slab.h"
-#include "knot/common.h"
 
 /*! \brief Type-safe maximum macro. */
 #define SLAB_MAX(a, b) \
diff --git a/src/tests/knot/journal_tests.c b/src/tests/knot/journal_tests.c
index 0146e5f475f6571c9021dc7383f3f69c589fe2ff..d61a1498d8312cf0ea2e61c3301ceec2cb0bd72c 100644
--- a/src/tests/knot/journal_tests.c
+++ b/src/tests/knot/journal_tests.c
@@ -19,7 +19,7 @@
 
 #include "tests/knot/journal_tests.h"
 #include "knot/server/journal.h"
-#include "knot/common.h"
+#include "knot/knot.h"
 
 static int journal_tests_count(int argc, char *argv[]);
 static int journal_tests_run(int argc, char *argv[]);
diff --git a/src/tests/knot/rrl_tests.c b/src/tests/knot/rrl_tests.c
index db0bbb995256fd41690fc96b9380efac960086f9..e7d26dd3b8fad976f3360f80ba936db48cd2034b 100644
--- a/src/tests/knot/rrl_tests.c
+++ b/src/tests/knot/rrl_tests.c
@@ -20,7 +20,7 @@
 #include "tests/knot/rrl_tests.h"
 #include "knot/server/rrl.h"
 #include "knot/server/dthreads.h"
-#include "knot/common.h"
+#include "knot/knot.h"
 #include "libknot/packet/response.h"
 #include "libknot/packet/query.h"
 #include "libknot/nameserver/name-server.h"
diff --git a/src/tests/unittests_main.c b/src/tests/unittests_main.c
index 9e0dcad4b77fab94e786c47c536baf565b6c5987..d0bef81e22e94d97ea250accf4c2f2b602566557 100644
--- a/src/tests/unittests_main.c
+++ b/src/tests/unittests_main.c
@@ -15,7 +15,7 @@
  */
 
 #include <config.h>
-#include "knot/common.h"
+#include "knot/knot.h"
 #include "common/libtap/tap_unit.h"
 
 // Units to test
diff --git a/src/tests/xfr_tests.c b/src/tests/xfr_tests.c
index 70360d14d47602ea71d9639d03c8469a6beb727e..fee09f2680d8e44d98da2f3199e1d5468f6bff87 100644
--- a/src/tests/xfr_tests.c
+++ b/src/tests/xfr_tests.c
@@ -29,7 +29,7 @@
 #include <getopt.h>
 #include <assert.h>
 
-#include "knot/common.h"
+#include "knot/knot.h"
 #include "knot/server/server.h"
 #include "knot/ctl/process.h"
 #include "knot/conf/conf.h"