diff --git a/inc/common/common.h b/inc/common/common.h
index 47ec665100afb534ebb09b97ca13649082efdd5f..1b930726ff83c7dedf59c4ddde86a6c0fd10dbaa 100644
--- a/inc/common/common.h
+++ b/inc/common/common.h
@@ -2,6 +2,7 @@
 
 #include <common/macro.h>
 #include <unistd.h>
+#include <stdint.h>
 
 #define not_implemented() __not_implemented(__func__,__FILE__,__LINE__)
 extern void __not_implemented(const char *func, char *file, int line);
@@ -12,3 +13,24 @@ void __unused(void *, ...);
 long get_mtime(const char *path);
 
 void *safe_malloc(size_t size);
+
+int is_utf8(const char *string);
+
+/* Read `bytes` as the big endian representation of a 32-bit unsigned integer.
+   `n` is the number of bytes in `bytes`
+   Returns 0 if n is 0.
+   Restriction: n <= 4 */
+uint32_t be_uint32_t(const uint8_t bytes[], size_t n);
+
+/* Same as `be_uint32_t` but for 64-bit unsigned integers.
+   Restriction: n <= 8 */
+uint64_t be_uint64_t(const uint8_t bytes[], size_t n);
+
+/* Trim the string `str` of the char `c` from the right and the left.
+   The string may not be null terminated.
+   Returns a pointer to the the trimmed string
+   Restrictions: the len of the string must be `len`. */
+char *trim(char *str, size_t len, char c);
+
+/* Get a line from stdin safely. */
+int get_stdin_line(const char *prompt, char *buf, size_t len);
diff --git a/inc/common/macro.h b/inc/common/macro.h
index be074b7b8c5f86f0580ae40865b54ffd6631665f..cc89cf2431af3263d8c6aa0eba34bf5e531d3d35 100644
--- a/inc/common/macro.h
+++ b/inc/common/macro.h
@@ -1,5 +1,8 @@
 #pragma once
 
+#include <stdint.h>
+#include <stdlib.h>
+
 /* Max value for any buffer, to not squash the stack. */
 #define BUFFER_MAX 4096
 
@@ -60,3 +63,109 @@
 #define LOG_WARN(format, ...)                   LOG_WARN_SCT("", format, __VA_ARGS__)
 #define LOG_ERROR(format, ...)                  LOG_DEBUG_SCT("", format, __VA_ARGS__)
 #define LOG_DEBUG(format, ...)                  LOG_DEBUG_SCT("", format, __VA_ARGS__)
+
+/* Defines for lektor */
+
+#define INI_MAX_LINE_LEN    512
+#define INI_MAX_SECTION_LEN 80
+
+#define URL_MAX_LEN         1024
+#define DEFAULT_URL         "https://kurisu.iiens.net"
+#define GET_ID_JSON         DEFAULT_URL "/api_karas.php?id=%ld"
+#define GET_ID_FILE         DEFAULT_URL "/download.php?id=%ld"
+
+#define SELF_EXECUTABLE_LINUX           "/proc/self/exe"
+#define SELF_EXECUTABLE_FREEBSD         "/proc/curproc/file"
+#define SELF_EXECUTABLE_SOLARIS         "/proc/self/path/a.out"
+
+
+#define LKT_MAX_SQLITE_STATEMENT        1024
+#define PROTECTED_DATABASE              "disk"
+
+#define LKT_DATABASE_NAME_KID           "id"
+#define LKT_DATABASE_NAME_KNAME         "source_name"
+#define LKT_DATABASE_NAME_KTITLE        "song_title"
+#define LKT_DATABASE_NAME_KCAT          "category"
+#define LKT_DATABASE_NAME_KTYPE         "song_type"
+#define LKT_DATABASE_NAME_KAUTHOR       "author_name"
+#define LKT_DATABASE_NAME_KAUTHOR_YEAR  "author_year"
+#define LKT_DATABASE_NAME_KLANG         "language"
+#define LKT_DATABASE_KARA_COLUMNT_ANY   "any_col"
+#define LKT_DATABASE_KARA_ALL           "string"
+
+#define LEKTOR_TAG_MAX                  256
+#define LKT_MESSAGE_ARGS_MAX            32
+#define LKT_MESSAGE_MAX                 2048
+#define LKT_DEFAULT_LIST_SIZE           10
+
+typedef volatile enum {
+    MPD_IDLE_NONE               = 0,
+
+    MPD_IDLE_DATABASE           = ( 1 << 1  ),
+    MPD_IDLE_UPDATE             = ( 1 << 2  ),
+    MPD_IDLE_STORED_PLAYLIST    = ( 1 << 3  ),
+    MPD_IDLE_PLAYLIST           = ( 1 << 4  ),
+    MPD_IDLE_PLAYER             = ( 1 << 5  ),
+    MPD_IDLE_MIXER              = ( 1 << 6  ),
+    MPD_IDLE_OUTPUT             = ( 1 << 7  ),
+    MPD_IDLE_OPTIONS            = ( 1 << 8  ),
+    MPD_IDLE_PARTITION          = ( 1 << 9  ),
+    MPD_IDLE_STICKER            = ( 1 << 10 ),
+    MPD_IDLE_SUBSCRIPTION       = ( 1 << 11 ),
+    MPD_IDLE_MESSAGE            = ( 1 << 12 ),
+
+    MPD_IDLE_ALL =
+        MPD_IDLE_DATABASE | MPD_IDLE_UPDATE | MPD_IDLE_STORED_PLAYLIST  |
+        MPD_IDLE_PLAYLIST | MPD_IDLE_PLAYER | MPD_IDLE_MIXER            |
+        MPD_IDLE_OUTPUT | MPD_IDLE_OPTIONS | MPD_IDLE_PARTITION         |
+        MPD_IDLE_STICKER | MPD_IDLE_SUBSCRIPTION | MPD_IDLE_MESSAGE,
+} mpd_idle_flag;
+
+#define LKT_BACKLOG         32
+#define COMMAND_LIST_MAX    64
+#define BUFFER_OUT_MAX      16
+#define MPD_VERSION         "0.21.16"
+
+/* Macros */
+
+#define SQLITE_PREPARE(db, stmt, SQL, goto_label)                               \
+    if (sqlite3_prepare_v2((sqlite3 *) db, SQL, -1, &(stmt), 0) != SQLITE_OK) { \
+        LOG_ERROR_SCT("DB", "Failed to prepare statement: %s",                  \
+                      sqlite3_errmsg((sqlite3 *) db));                          \
+        goto goto_label;                                                        \
+    }
+
+#define SQLITE_EXEC(db, SQL, goto_label)                                        \
+    if (sqlite3_exec((sqlite3 *) db, SQL, NULL, NULL, NULL) != SQLITE_OK) {     \
+        LOG_ERROR_SCT("DB", "Failed to exec statement: %s",                     \
+                      sqlite3_errmsg((sqlite3 *) db));                          \
+        goto goto_label;                                                        \
+    }
+
+#define SQLITE_BIND_TEXT(db, stmt, pos, text, error)                    \
+    if (sqlite3_bind_text(stmt, pos, text, -1, 0) != SQLITE_OK) {       \
+        LOG_ERROR_SCT("DB", "Failed to bind text %s at pos %d: %s",     \
+                      text, pos, sqlite3_errmsg((sqlite3 *) db));       \
+        goto error;                                                     \
+    }
+
+#define SQLITE_BIND_INT(db, stmt, pos, integer, error)                  \
+    if (sqlite3_bind_int(stmt, pos, integer) != SQLITE_OK) {            \
+        LOG_ERROR_SCT("DB", "Failed to bind int %d at pos %d: %s",      \
+                      integer, pos, sqlite3_errmsg((sqlite3 *) db));    \
+        goto error;                                                     \
+    }
+
+#define SQLITE_STEP(db, stmt, code, error)                              \
+    if (sqlite3_step(stmt) != code) {                                   \
+        LOG_ERROR_SCT("DB", "Failed to step: %s",                       \
+                      sqlite3_errmsg((sqlite3 *) db));                  \
+        goto error;                                                     \
+    }
+
+#define SQLITE_STEP_ROW(db, stmt, error)    SQLITE_STEP(db, stmt, SQLITE_ROW, error)
+#define SQLITE_STEP_DONE(db, stmt, error)   SQLITE_STEP(db, stmt, SQLITE_DONE, error)
+#define SQLITE_STEP_OK(db, stmt, error)     SQLITE_STEP(db, stmt, SQLITE_OK, error)
+
+#define SQLITE_DO_ROLLBACK(db)                                          \
+    sqlite3_exec((sqlite3 *) db, "ROLLBACK TRANSACTION;\n", NULL, NULL, NULL);
diff --git a/inc/lektor/bufferfd.h b/inc/lektor/bufferfd.h
index c6e4ccbc826bcc4608bc1f67618aa2bff3c36f71..ffc4aacd4cf2fc56693cb4bdf501d2840c82fa92 100644
--- a/inc/lektor/bufferfd.h
+++ b/inc/lektor/bufferfd.h
@@ -23,7 +23,7 @@
 
 #pragma once
 
-#include <lektor/common.h>
+#include <common/common.h>
 #include <stdint.h>
 #include <stdlib.h>
 
diff --git a/inc/lektor/commands.h b/inc/lektor/commands.h
index 452d46bb66de87a963e52de47934b0e08912540e..a447ef3604501b192301410c5a365e592b11092e 100644
--- a/inc/lektor/commands.h
+++ b/inc/lektor/commands.h
@@ -1,6 +1,6 @@
 #pragma once
 
-#include <lektor/common.h>
+#include <common/common.h>
 #include <lektor/net.h>
 #include <lektor/window.h>
 
diff --git a/inc/lektor/common.h b/inc/lektor/common.h
deleted file mode 100644
index 7b0839cb4a69ad759e507ac293527fc462cf0e1c..0000000000000000000000000000000000000000
--- a/inc/lektor/common.h
+++ /dev/null
@@ -1,132 +0,0 @@
-#pragma once
-
-#include <common/common.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-/* Defines */
-
-#define INI_MAX_LINE_LEN    512
-#define INI_MAX_SECTION_LEN 80
-
-#define URL_MAX_LEN         1024
-#define DEFAULT_URL         "https://kurisu.iiens.net"
-#define GET_ID_JSON         DEFAULT_URL "/api_karas.php?id=%ld"
-#define GET_ID_FILE         DEFAULT_URL "/download.php?id=%ld"
-
-#define SELF_EXECUTABLE_LINUX           "/proc/self/exe"
-#define SELF_EXECUTABLE_FREEBSD         "/proc/curproc/file"
-#define SELF_EXECUTABLE_SOLARIS         "/proc/self/path/a.out"
-
-
-#define LKT_MAX_SQLITE_STATEMENT        1024
-#define PROTECTED_DATABASE              "disk"
-
-#define LKT_DATABASE_NAME_KID           "id"
-#define LKT_DATABASE_NAME_KNAME         "source_name"
-#define LKT_DATABASE_NAME_KTITLE        "song_title"
-#define LKT_DATABASE_NAME_KCAT          "category"
-#define LKT_DATABASE_NAME_KTYPE         "song_type"
-#define LKT_DATABASE_NAME_KAUTHOR       "author_name"
-#define LKT_DATABASE_NAME_KAUTHOR_YEAR  "author_year"
-#define LKT_DATABASE_NAME_KLANG         "language"
-#define LKT_DATABASE_KARA_COLUMNT_ANY   "any_col"
-#define LKT_DATABASE_KARA_ALL           "string"
-
-#define LEKTOR_TAG_MAX                  256
-#define LKT_MESSAGE_ARGS_MAX            32
-#define LKT_MESSAGE_MAX                 2048
-#define LKT_DEFAULT_LIST_SIZE           10
-
-typedef volatile enum {
-    MPD_IDLE_NONE               = 0,
-
-    MPD_IDLE_DATABASE           = ( 1 << 1  ),
-    MPD_IDLE_UPDATE             = ( 1 << 2  ),
-    MPD_IDLE_STORED_PLAYLIST    = ( 1 << 3  ),
-    MPD_IDLE_PLAYLIST           = ( 1 << 4  ),
-    MPD_IDLE_PLAYER             = ( 1 << 5  ),
-    MPD_IDLE_MIXER              = ( 1 << 6  ),
-    MPD_IDLE_OUTPUT             = ( 1 << 7  ),
-    MPD_IDLE_OPTIONS            = ( 1 << 8  ),
-    MPD_IDLE_PARTITION          = ( 1 << 9  ),
-    MPD_IDLE_STICKER            = ( 1 << 10 ),
-    MPD_IDLE_SUBSCRIPTION       = ( 1 << 11 ),
-    MPD_IDLE_MESSAGE            = ( 1 << 12 ),
-
-    MPD_IDLE_ALL =
-        MPD_IDLE_DATABASE | MPD_IDLE_UPDATE | MPD_IDLE_STORED_PLAYLIST  |
-        MPD_IDLE_PLAYLIST | MPD_IDLE_PLAYER | MPD_IDLE_MIXER            |
-        MPD_IDLE_OUTPUT | MPD_IDLE_OPTIONS | MPD_IDLE_PARTITION         |
-        MPD_IDLE_STICKER | MPD_IDLE_SUBSCRIPTION | MPD_IDLE_MESSAGE,
-} mpd_idle_flag;
-
-#define LKT_BACKLOG         32
-#define COMMAND_LIST_MAX    64
-#define BUFFER_OUT_MAX      16
-#define MPD_VERSION         "0.21.16"
-
-/* Macros */
-
-#define SQLITE_PREPARE(db, stmt, SQL, goto_label)                               \
-    if (sqlite3_prepare_v2((sqlite3 *) db, SQL, -1, &(stmt), 0) != SQLITE_OK) { \
-        LOG_ERROR_SCT("DB", "Failed to prepare statement: %s",                  \
-                      sqlite3_errmsg((sqlite3 *) db));                          \
-        goto goto_label;                                                        \
-    }
-
-#define SQLITE_EXEC(db, SQL, goto_label)                                        \
-    if (sqlite3_exec((sqlite3 *) db, SQL, NULL, NULL, NULL) != SQLITE_OK) {     \
-        LOG_ERROR_SCT("DB", "Failed to exec statement: %s",                     \
-                      sqlite3_errmsg((sqlite3 *) db));                          \
-        goto goto_label;                                                        \
-    }
-
-#define SQLITE_BIND_TEXT(db, stmt, pos, text, error)                    \
-    if (sqlite3_bind_text(stmt, pos, text, -1, 0) != SQLITE_OK) {       \
-        LOG_ERROR_SCT("DB", "Failed to bind text %s at pos %d: %s",     \
-                      text, pos, sqlite3_errmsg((sqlite3 *) db));       \
-        goto error;                                                     \
-    }
-
-#define SQLITE_BIND_INT(db, stmt, pos, integer, error)                  \
-    if (sqlite3_bind_int(stmt, pos, integer) != SQLITE_OK) {            \
-        LOG_ERROR_SCT("DB", "Failed to bind int %d at pos %d: %s",      \
-                      integer, pos, sqlite3_errmsg((sqlite3 *) db));    \
-        goto error;                                                     \
-    }
-
-#define SQLITE_STEP(db, stmt, code, error)                              \
-    if (sqlite3_step(stmt) != code) {                                   \
-        LOG_ERROR_SCT("DB", "Failed to step: %s",                       \
-                      sqlite3_errmsg((sqlite3 *) db));                  \
-        goto error;                                                     \
-    }
-
-#define SQLITE_STEP_ROW(db, stmt, error)    SQLITE_STEP(db, stmt, SQLITE_ROW, error)
-#define SQLITE_STEP_DONE(db, stmt, error)   SQLITE_STEP(db, stmt, SQLITE_DONE, error)
-#define SQLITE_STEP_OK(db, stmt, error)     SQLITE_STEP(db, stmt, SQLITE_OK, error)
-
-#define SQLITE_DO_ROLLBACK(db)                                          \
-    sqlite3_exec((sqlite3 *) db, "ROLLBACK TRANSACTION;\n", NULL, NULL, NULL);
-
-/* Random things */
-
-/* Read `bytes` as the big endian representation of a 32-bit unsigned integer.
-   `n` is the number of bytes in `bytes`
-   Returns 0 if n is 0.
-   Restriction: n <= 4 */
-uint32_t be_uint32_t(const uint8_t bytes[], size_t n);
-
-/* Same as `be_uint32_t` but for 64-bit unsigned integers.
-   Restriction: n <= 8 */
-uint64_t be_uint64_t(const uint8_t bytes[], size_t n);
-
-/* Trim the string `str` of the char `c` from the right and the left.
-   The string may not be null terminated.
-   Returns a pointer to the the trimmed string
-   Restrictions: the len of the string must be `len`. */
-char *trim(char *str, size_t len, char c);
-
-/* Get a line from stdin safely. */
-int get_stdin_line(const char *prompt, char *buf, size_t len);
diff --git a/inc/lektor/config.h b/inc/lektor/config.h
index f9e91358e13b4d548e6ac2ee90d0929086648e74..9affc9529330628379d66d95ba60885222b68321 100644
--- a/inc/lektor/config.h
+++ b/inc/lektor/config.h
@@ -1,6 +1,6 @@
 #pragma once
 
-#include <lektor/common.h>
+#include <common/common.h>
 #include <stddef.h>
 #include <sqlite3.h>
 
diff --git a/inc/lektor/database.h b/inc/lektor/database.h
index e1bffe157531612952a744378f9b7bff822c5604..1e7a7bfb66fa5207cc399d9158601e3f0c22373b 100644
--- a/inc/lektor/database.h
+++ b/inc/lektor/database.h
@@ -1,6 +1,6 @@
 #pragma once
 
-#include <lektor/common.h>
+#include <common/common.h>
 #include <lektor/mkv.h>
 #include <lektor/uri.h>
 
diff --git a/inc/lektor/mkv.h b/inc/lektor/mkv.h
index c88114269b99f7087f27a031160f77922faf0cff..21b3808c0b7ea7d3d27f99d101787729fafa5de2 100644
--- a/inc/lektor/mkv.h
+++ b/inc/lektor/mkv.h
@@ -23,7 +23,7 @@
  */
 #pragma once
 
-#include <lektor/common.h>
+#include <common/common.h>
 #include <linux/limits.h>
 #include <stddef.h>
 
diff --git a/inc/lektor/module/mpv.h b/inc/lektor/module/mpv.h
index a05fdaf900d5e2ad7a42de29dfaa929551fe7f87..db2070c48575be514ae6249d8e94449817cd7095 100644
--- a/inc/lektor/module/mpv.h
+++ b/inc/lektor/module/mpv.h
@@ -3,7 +3,7 @@
 #include <sqlite3.h>
 #include <mpv/client.h>
 #include <lektor/net.h>
-#include <lektor/common.h>
+#include <common/common.h>
 
 void lmpv_free(mpv_handle **ctx);
 mpv_handle *lmpv_new(unsigned long int wid);
diff --git a/inc/lektor/net.h b/inc/lektor/net.h
index fa721922d37e843e5d50cb0c82554779421a5950..1a4e96a780a486f11ab23410574468788560f8f2 100644
--- a/inc/lektor/net.h
+++ b/inc/lektor/net.h
@@ -1,7 +1,7 @@
 #pragma once
 
+#include <common/common.h>
 #include <lektor/mkv.h>
-#include <lektor/common.h>
 #include <lektor/config.h>
 #include <lektor/window.h>
 #include <lektor/thread.h>
diff --git a/inc/lektor/thread.h b/inc/lektor/thread.h
index 3e5e07a7ec809eedcda4642e8ac47233f2fd4e75..7a85147f7ab09ec0901a43f1559386f63a32e3fe 100644
--- a/inc/lektor/thread.h
+++ b/inc/lektor/thread.h
@@ -1,6 +1,6 @@
 #pragma once
 
-#include <lektor/common.h>
+#include <common/common.h>
 #include <pthread.h>
 #include <sys/types.h>
 
diff --git a/inc/lektor/uri.h b/inc/lektor/uri.h
index c9a4d932566e8432b932bcbe676d69803d6cab41..b9ab50874ab07d438ef3a30bc666c337a9f41348 100644
--- a/inc/lektor/uri.h
+++ b/inc/lektor/uri.h
@@ -1,6 +1,5 @@
 #pragma once
 
-#include <lektor/common.h>
 #include <stddef.h>
 #include <stddef.h>
 #include <stdbool.h>
diff --git a/inc/lektor/window.h b/inc/lektor/window.h
index ab5f43b8b7e453874f393558029a0a6eb60e69fd..d61ed465718bf5ceced7d0dd2e7bdb335947b999 100644
--- a/inc/lektor/window.h
+++ b/inc/lektor/window.h
@@ -1,6 +1,6 @@
 #pragma once
 
-#include <lektor/common.h>
+#include <common/common.h>
 #include <stdbool.h>
 #include <sqlite3.h>
 
diff --git a/src/cmd.c b/src/cmd.c
index 9cd2b0122c354fdb2c6f69f8530f151dbd3f10c0..b56e868ed499b0c89bbeb5c51b6b93f6d8180e30 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -1,7 +1,7 @@
 #define _POSIX_C_SOURCE 200809L
 
 #include <lektor/cmd.h>
-#include <lektor/common.h>
+#include <common/common.h>
 #include <sys/types.h>
 #include <stdlib.h>
 #include <strings.h>
diff --git a/src/commands.c b/src/commands.c
index cc53c0c4a97f77739c24b2d270c2a7c276f1cf6b..7243a00bcadf8e4e81457d76ca7c37059a740b0a 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -1,7 +1,6 @@
 #define _POSIX_C_SOURCE 200809L
 
 #include <common/common.h>
-#include <lektor/common.h>
 #include <lektor/commands.h>
 #include <lektor/database.h>
 #include <lektor/net.h>
diff --git a/src/common.c b/src/common.c
index df21628da60ac732423adbc7ad7f6f28be7dddab..95a57368d5fa2f998cb34b0158861678d48df5f3 100644
--- a/src/common.c
+++ b/src/common.c
@@ -1,3 +1,5 @@
+#define _POSIX_C_SOURCE 200809L
+
 #include <common/common.h>
 #include <stdint.h>
 #include <stdio.h>
diff --git a/src/config.c b/src/config.c
index e5a7a688f84001b5d62b24ba934ab8f07c9f6f73..707c48ecd7d904405b0863e7467cda4942b4b1b4 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1,7 +1,6 @@
 #define _POSIX_C_SOURCE 200809L
 
 #include <common/common.h>
-#include <lektor/common.h>
 #include <lektor/config.h>
 #include <lektor/database.h>
 #include <stdlib.h>
diff --git a/src/database/config.c b/src/database/config.c
index c2802ffdc9ae32a7d2179d26c27013c3ebc11ab5..00c82c62750cafcf78cfb4fa33f35e0c4738abe9 100644
--- a/src/database/config.c
+++ b/src/database/config.c
@@ -1,7 +1,7 @@
 #define _POSIX_C_SOURCE 200809L
 
+#include <common/common.h>
 #include <lektor/database.h>
-#include <lektor/common.h>
 
 #include <limits.h>
 #include <stdio.h>
diff --git a/src/database/find.c b/src/database/find.c
index ffc4b43706745737dbf21e8289763ac18fdae11c..61205fe97ecf03b34acd92738de91f71d17cc970 100644
--- a/src/database/find.c
+++ b/src/database/find.c
@@ -1,7 +1,7 @@
 #define _POSIX_C_SOURCE 200809L
 
+#include <common/common.h>
 #include <lektor/database.h>
-#include <lektor/common.h>
 
 #include <limits.h>
 #include <stdio.h>
diff --git a/src/database/open.c b/src/database/open.c
index dfc470ee46d78c0fdea3151cc90342f8621e0862..24b9fec3fcb855b49a9700cf81c4a1c71533bebc 100644
--- a/src/database/open.c
+++ b/src/database/open.c
@@ -1,7 +1,7 @@
 #define _POSIX_C_SOURCE 200809L
 
+#include <common/common.h>
 #include <lektor/database.h>
-#include <lektor/common.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/src/database/playlist.c b/src/database/playlist.c
index 2079ec836c5b8433595b031cee830a1ec7b0f2c6..96f704f075d18d16f217122741422ef532095640 100644
--- a/src/database/playlist.c
+++ b/src/database/playlist.c
@@ -2,7 +2,6 @@
 
 #include <common/common.h>
 #include <lektor/database.h>
-#include <lektor/common.h>
 #include <stdio.h>
 #include <strings.h>
 
diff --git a/src/database/queue.c b/src/database/queue.c
index 8cf4fae3838e6d8f98d1414cbce037c8ff9caa15..770796c60a8cc2b9aaddb0b8b5447c77fc0bd3b7 100644
--- a/src/database/queue.c
+++ b/src/database/queue.c
@@ -1,7 +1,7 @@
 #define _POSIX_C_SOURCE 200809L
 
+#include <common/common.h>
 #include <lektor/database.h>
-#include <lektor/common.h>
 
 #include <linux/limits.h>
 #include <stdio.h>
diff --git a/src/database/stickers.c b/src/database/stickers.c
index e2fc96ee246307692c49f3f56c9c3f4c4c522ce3..376621987d250e6819dd9feb44637f7a6e44d2ad 100644
--- a/src/database/stickers.c
+++ b/src/database/stickers.c
@@ -1,6 +1,6 @@
 #define _POSIX_C_SOURCE 200809L
 
-#include <lektor/common.h>
+#include <common/common.h>
 #include <lektor/database.h>
 #include <string.h>
 #include <strings.h>
diff --git a/src/database/update.c b/src/database/update.c
index 80429007333c98526a9efa5988b88f498ddbcd33..cacb7badeb5217a6cf4aea91aaf457526981849d 100644
--- a/src/database/update.c
+++ b/src/database/update.c
@@ -3,7 +3,6 @@
 
 #include <common/common.h>
 #include <lektor/database.h>
-#include <lektor/common.h>
 
 #include <stdbool.h>
 #include <sqlite3.h>
diff --git a/src/database/user.c b/src/database/user.c
index ab347f401611a764df89a91429c9ecd3cca6ba7b..cad67826f5fec56ab1e9b58dea3121d729de8a28 100644
--- a/src/database/user.c
+++ b/src/database/user.c
@@ -1,7 +1,7 @@
 #define _POSIX_C_SOURCE 200809L
 
+#include <common/common.h>
 #include <lektor/database.h>
-#include <lektor/common.h>
 #include <stdio.h>
 
 bool
diff --git a/src/main/lkt.c b/src/main/lkt.c
index 8ea952bd2556dd90061d75f69a3ad4465eed3293..94114a9475e01a9b5a7c1da0275c6280a22b2a30 100644
--- a/src/main/lkt.c
+++ b/src/main/lkt.c
@@ -3,6 +3,7 @@
 #include <common/common.h>
 #include <lektor/net.h>
 #include <lektor/cmd.h>
+
 #include <arpa/inet.h>
 #include <sys/types.h>
 #include <sys/socket.h>
diff --git a/src/main/lktadm.c b/src/main/lktadm.c
index a67d8d28e8fd7ef456fee98e25ef382044d9b1ac..d4b25a85a70ef67216438c99410045e56ca384cf 100644
--- a/src/main/lktadm.c
+++ b/src/main/lktadm.c
@@ -8,7 +8,6 @@
 #include <lektor/mkv.h>
 #include <lektor/database.h>
 #include <lektor/net.h>
-#include <lektor/common.h>
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/src/main/server.c b/src/main/server.c
index 434784e236c647b1bed0f592bff44b040160470e..ad3e0959c49d01f6ec0297bf4d8a630a7a021d9d 100644
--- a/src/main/server.c
+++ b/src/main/server.c
@@ -5,6 +5,7 @@
 #include <lektor/net.h>
 #include <lektor/database.h>
 #include <mthread/mthread.h>
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
diff --git a/src/mkv/mkv.c b/src/mkv/mkv.c
index 39efb961d862e45aed4616d9259ae61693524455..a62d536f4603c6a1e8d5c0fce12c0383e53cb0c6 100644
--- a/src/mkv/mkv.c
+++ b/src/mkv/mkv.c
@@ -1,3 +1,5 @@
+#define _POSIX_C_SOURCE 200809L
+
 #include <fcntl.h>
 #include <stdint.h>
 #include <stdio.h>
@@ -7,7 +9,7 @@
 
 #include <lektor/bufferfd.h>
 #include <lektor/mkv.h>
-#include <lektor/common.h>
+#include <common/common.h>
 
 #define MKV_TAG_MAX 64
 
diff --git a/src/module/module_x11.c b/src/module/module_x11.c
index 8fd16618577280c9f22cdb50e4e6714c8702bebf..5852a9c4cf6cd70f0cf56bc65eb59be70694b8b1 100644
--- a/src/module/module_x11.c
+++ b/src/module/module_x11.c
@@ -2,7 +2,6 @@
 
 #include <common/common.h>
 #include <lektor/module/module_x11.h>
-#include <lektor/common.h>
 #include <lektor/module/mpv.h>
 #include <lektor/database.h>
 #include <lektor/commands.h>
diff --git a/src/module/mpv.c b/src/module/mpv.c
index 2fc401d0166cf1898fc1dd121d341fa5072e7956..b29d71532d5f98becd77e64223070b5c23a43d83 100644
--- a/src/module/mpv.c
+++ b/src/module/mpv.c
@@ -4,7 +4,6 @@
 #include <lektor/module/mpv.h>
 #include <lektor/commands.h>
 #include <lektor/database.h>
-#include <lektor/common.h>
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
diff --git a/src/net/downloader.c b/src/net/downloader.c
index 96abec51a631caf426e3a7b6593d4ccfa285a93b..9df9b1bae07918d97f759d4c2c93d74336d46c0e 100644
--- a/src/net/downloader.c
+++ b/src/net/downloader.c
@@ -12,7 +12,6 @@
 
 #include <common/common.h>
 #include <mthread/mthread.h>
-#include <lektor/common.h>
 #include <lektor/database.h>
 #include <lektor/net.h>
 
diff --git a/src/net/listen.c b/src/net/listen.c
index 489c5e798d2911b280bfdb462386d91c57ad7449..4c73ff20c836f587d0e71dcf9997d8549c05bbe0 100644
--- a/src/net/listen.c
+++ b/src/net/listen.c
@@ -2,7 +2,6 @@
 
 #include <common/common.h>
 #include <lektor/commands.h>
-#include <lektor/common.h>
 #include <lektor/database.h>
 #include <lektor/net.h>
 
diff --git a/src/net/message.c b/src/net/message.c
index 16dab3836b85a9e16298ab5a1edd227f121b8028..21d3bf32488ed13450827e790d684b069a7438e5 100644
--- a/src/net/message.c
+++ b/src/net/message.c
@@ -1,5 +1,6 @@
-#include <lektor/net.h>
+#define _POSIX_C_SOURCE 200809L
 
+#include <lektor/net.h>
 #include <stdlib.h>
 
 struct lkt_message *
diff --git a/src/uri.c b/src/uri.c
index ac8634be845720818b767601c8f5358d318dcd2d..ec076ed25e67e30fc1eeb8418efffa51107092f7 100644
--- a/src/uri.c
+++ b/src/uri.c
@@ -1,3 +1,6 @@
+#define _POSIX_C_SOURCE 200809L
+
+#include <common/common.h>
 #include <lektor/uri.h>
 #include <stdlib.h>
 #include <string.h>