diff --git a/inc/lektor/commands.h b/inc/lektor/commands.h
index e7199bed2efb1eb953f17b3735e9e16ac41d3ccf..a9091eacff72fa2ff1d33b97efd1e8155258af27 100644
--- a/inc/lektor/commands.h
+++ b/inc/lektor/commands.h
@@ -92,7 +92,7 @@ bool command_set_playback_option(struct lkt_state *srv, size_t c, enum lkt_playb
 
 /* Authentificate users */
 bool command_password(struct lkt_state *srv, size_t c, char *argv[LKT_MESSAGE_ARGS_MAX]);
-bool command_user_add(sqlite3 *db, char *argv[LKT_MESSAGE_ARGS_MAX]);
+bool command_user_add(struct lkt_state *srv, size_t c, sqlite3 *db, char *argv[LKT_MESSAGE_ARGS_MAX]);
 
 /* Program management control */
 bool command_restart(struct lkt_state *srv, size_t c);
diff --git a/inc/lektor/defines.h b/inc/lektor/defines.h
index 84f263d6d7b056e62e29ae47aab22e002c22ddb3..0b8fb58bd78c0ccc9f4ffd9a8d000955ae00e22a 100644
--- a/inc/lektor/defines.h
+++ b/inc/lektor/defines.h
@@ -47,3 +47,9 @@ enum mpd_idle_flag {
         MPD_IDLE_OUTPUT | MPD_IDLE_OPTIONS | MPD_IDLE_PARTITION         |
         MPD_IDLE_STICKER | MPD_IDLE_SUBSCRIPTION | MPD_IDLE_MESSAGE,
 };
+
+#define LKT_BACKLOG         32
+#define COMMAND_LIST_MAX    64
+#define BUFFER_OUT_MAX      16
+#define MPD_VERSION         "0.21.16"
+
diff --git a/src/commands.c b/src/commands.c
index d03489ed66eb3824dbe1c970feffd1cc5b7f1a9c..024532b0b98aec0a297f80f08099acf60e2e07f9 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -27,11 +27,7 @@ command_restart(struct lkt_state *srv, size_t c)
 {
     char exe[PATH_MAX];
     char *const argv[] = { exe, NULL };
-
-    if (!lkt_client_auth(srv, c, false)) {
-        fprintf(stderr, " ! command_restart: Failed to restart, user not authentificated %lu\n", c);
-        return false;
-    }
+    RETURN_UNLESS(lkt_client_auth(srv, c, false), "Failed to authentificate user", false);
 
     if (readlink(SELF_EXECUTABLE_LINUX, exe, PATH_MAX - 1) > 0) {
         fprintf(stderr, " * Restart lektord\n");
@@ -59,20 +55,14 @@ bool
 command_rescan(struct lkt_state *srv, size_t c, char *argv[LKT_MESSAGE_ARGS_MAX])
 {
     (void) argv;
-    if (!lkt_client_auth(srv, c, false)) {
-        fprintf(stderr, " ! command_rescan: Failed, user %lu not authentificated\n", c);
-        return false;
-    }
+    RETURN_UNLESS(lkt_client_auth(srv, c, false), "Failed to authentificate user", false);
     return ! repo_get_allid_async();
 }
 
 inline bool
 command_kill(struct lkt_state *srv, size_t c)
 {
-    if (!lkt_client_auth(srv, c, false)) {
-        fprintf(stderr, " ! command_restart: Failed to restart, user not authentificated %lu\n", c);
-        return false;
-    }
+    RETURN_UNLESS(lkt_client_auth(srv, c, false), "Failed to authentificate user", false);
     fprintf(stderr, " * Stopping lektord\n");
     close(srv->fds[0].fd);
     exit(EXIT_SUCCESS);
@@ -88,7 +78,7 @@ command_currentsong(struct lkt_state *srv, size_t c)
     memset(&kara, 0, sizeof(struct kara_metadata));
 
     if (!database_queue_current_kara(srv->db, &kara, NULL))
-        fprintf(stderr, " ! command_currentsong: Failed to get information about the current kara\n");
+        fprintf(stderr, " . command_currentsong: Failed to get information about the current kara\n");
 
     out = lkt_message_new();
     idx = snprintf(out->data, LKT_MESSAGE_MAX,
@@ -115,16 +105,9 @@ command_status(struct lkt_state *srv, size_t c)
     int elapsed, duration, songid = 0;
     const char *play_state;
 
-    if (srv == NULL)
-        return false;
-
+    RETURN_UNLESS(srv, "Invalid argument", false);
     win = &srv->win;
-
-    if (!database_queue_state(srv->db, &queue_state)) {
-        fprintf(stderr, " ! command_status: Could not fully determined the status of the playback\n");
-        return false;
-    }
-
+    RETURN_UNLESS(database_queue_state(srv->db, &queue_state), "Can't determine playback status", false);
     database_queue_current_kara(srv->db, NULL, &songid);
     win->get_elapsed(win, &elapsed);
     win->get_duration(win, &duration);
@@ -180,25 +163,10 @@ static inline bool
 __play_that_file(sqlite3 *db, struct lkt_win *win, int pos)
 {
     char filepath[PATH_MAX];
-
-    if (pos == 0)
-        return false;
-
-    if (!database_queue_play(db, (int) pos)) {
-        fprintf(stderr, " ! __play_that_file: command failed because of db interactions\n");
-        return false;
-    }
-
-    if (!database_queue_get_current_file(db, filepath)) {
-        fprintf(stderr, " ! __play_that_file: command failed because of get current\n");
-        return false;
-    }
-
-    if (!win->load_file(win, filepath)) {
-        fprintf(stderr, " ! __play_that_file: command failed because of get current\n");
-        return false;
-    }
-
+    RETURN_UNLESS(pos, "Invalid argument", false);
+    RETURN_UNLESS(database_queue_play(db, (int) pos), "DB error", false);
+    RETURN_UNLESS(database_queue_get_current_file(db, filepath), "Can't get current kara", false);
+    RETURN_UNLESS(win->load_file(win, filepath), "Can't load file", false);
     return true;
 }
 
@@ -213,27 +181,14 @@ command_play(sqlite3 *db, struct lkt_win *win, char *args[LKT_MESSAGE_ARGS_MAX],
     /* Argument handle. */
 
     pos = args[0] == NULL ? 1 : strtol(args[0], &endptr, 10);
-
-    if ((errno == ERANGE && (pos == LONG_MAX || pos == LONG_MIN))
-        || (errno != 0 && pos == 0)) {
-        fprintf(stderr, " ! command_play: strtol failed: %s\n", strerror(errno));
-        return false;
-    }
-
-    if (endptr == args[0]) {
-        fprintf(stderr, " . command_play: to digit found in string '%s'\n", args[1]);
-        return false;
-    }
+    RETURN_IF((errno == ERANGE && (pos == LONG_MAX || pos == LONG_MIN)) || (errno != 0 && pos == 0),
+              "Failed: strtol", false);
+    RETURN_IF(endptr == args[0], "No digit found", false);
 
     /* Do the actual job here. */
 
     database_queue_stop(db);
-
-    if (!win->new (win)) {
-        fprintf(stderr, " ! command_play: command failed because of null mpv ctx\n");
-        return false;
-    }
-
+    RETURN_UNLESS(win->new (win), "Can't create window", false);
     return __play_that_file(db, win, pos);
 }
 
@@ -248,29 +203,16 @@ command_playid(sqlite3 *db, struct lkt_win *win, char *args[LKT_MESSAGE_ARGS_MAX
 
     /* Argument handle. */
 
-    if (args[0] == NULL)
-        return false;
-
+    RETURN_IF(args[0] == NULL, "Invalid argument", false);
     id = strtol(args[0], &endptr, 10);
-
-    if ((errno == ERANGE && (id == LONG_MAX || id == LONG_MIN))
-        || (errno != 0 && id == 0)) {
-        fprintf(stderr, " ! command_playid: strtol failed: %s\n", strerror(errno));
-        return false;
-    }
-
-    if (endptr == args[0]) {
-        fprintf(stderr, " . command_playid: to digit found in string '%s'\n", args[1]);
-        return false;
-    }
+    RETURN_IF((errno == ERANGE && (id == LONG_MAX || id == LONG_MIN)) || (errno != 0 && id == 0),
+              "Failed: strtol", false);
+    RETURN_IF(endptr == args[0], "No digit found", false);
 
     /* Do the work. */
 
     database_queue_stop(db);
-
-    if (!win->new (win))
-        return false;
-
+    RETURN_UNLESS(win->new (win), "Can't create window", false);
     database_queue_seekid(db, (int) id, &pos);
     return __play_that_file(db, win, pos);
 }
@@ -279,34 +221,23 @@ command_playid(sqlite3 *db, struct lkt_win *win, char *args[LKT_MESSAGE_ARGS_MAX
 bool
 command_stop(sqlite3 *db, struct lkt_win *win, enum mpd_idle_flag *watch_mask_ptr)
 {
-    if (database_queue_stop(db)) {
-        win->close(win);
-        *watch_mask_ptr |= MPD_IDLE_PLAYER;
-        return true;
-    }
-    return false;
+    RETURN_UNLESS(database_queue_stop(db), "DB error", false);
+    win->close(win);
+    *watch_mask_ptr |= MPD_IDLE_PLAYER;
+    return true;
 }
 
 bool
 command_add(sqlite3 *db, struct lkt_win *win, char *args[LKT_MESSAGE_ARGS_MAX],
             enum mpd_idle_flag *watch_mask_ptr)
 {
-    if (args == NULL) {
-        fprintf(stderr, " ! command_add: invalid NULL arguments\n");
-        return false;
-    }
-
+    RETURN_UNLESS(args, "Invalid argument", false);
     *watch_mask_ptr |= MPD_IDLE_PLAYLIST;
     struct lkt_uri_t uri;
     char *query = args[0];
     int ret, priority = 1;  /* To be modified according to the command (insert or add) later (TODO) */
-
     (void) win;         // No callbacks to the window for the moment
-
-    if (!lkt_uri_from(&uri, query)) {
-        fprintf(stderr, " ! command_add: failed to parse query '%s', invalid uri\n", query);
-        return false;
-    }
+    RETURN_UNLESS(lkt_uri_from(&uri, query), "Failed to parse query", false);
 
     switch (uri.type) {
     case uri_query:
@@ -349,26 +280,14 @@ command_addid(sqlite3 *db, struct lkt_win *win, char *args[LKT_MESSAGE_ARGS_MAX]
     char *endptr, *id_str;
     int priority = 1;
 
-    if (args == NULL) {
-        fprintf(stderr, " ! command_add: invalid NULL arguments\n");
-        return false;
-    }
-
+    RETURN_UNLESS(args, "Invalid argument", false);
     id_str = args[0];
     errno = 0;
     *watch_mask_ptr |= MPD_IDLE_PLAYLIST;
     id = strtol(id_str, &endptr, 10);
-
-    if ((errno == ERANGE && (id == LONG_MAX || id == LONG_MIN)) || (errno != 0 && id == 0)) {
-        fprintf(stderr, " ! command_addid: strtol failed: %s\n", strerror(errno));
-        return false;
-    }
-
-    if (endptr == id_str) {
-        fprintf(stderr, " . command_addid: to digit found in string '%s'\n", id_str);
-        return false;
-    }
-
+    RETURN_IF((errno == ERANGE && (id == LONG_MAX || id == LONG_MIN)) || (errno != 0 && id == 0),
+              "Failed: strtol", false);
+    RETURN_IF(endptr == args[0], "No digit found", false);
     return database_queue_add_id(db, id, priority);
 }
 
@@ -397,23 +316,15 @@ command_delid(sqlite3 *db, struct lkt_win *win, char *id_str, enum mpd_idle_flag
     errno = 0;
     *watch_mask_ptr |= MPD_IDLE_PLAYLIST;
     id = strtol(id_str, &endptr, 10);
-
-    if ((errno == ERANGE && (id == LONG_MAX || id == LONG_MIN)) || (errno != 0 && id == 0)) {
-        fprintf(stderr, " ! command_delid: strtol failed: %s\n", strerror(errno));
-        return false;
-    }
-
-    if (endptr == id_str) {
-        fprintf(stderr, " . command_delid: to digit found in string '%s'\n", id_str);
-        return false;
-    }
+    RETURN_IF((errno == ERANGE && (id == LONG_MAX || id == LONG_MIN)) || (errno != 0 && id == 0),
+              "Failed: strtol", false);
+    RETURN_IF(endptr == id_str, "No digit found", false);
 
     /* If one day we allow suppression of the current kara, will need the `win`
        pointer to reload the kara in the same position (but the kara won't be
        the same). */
     database_queue_current_kara(db, NULL, &uri);
-    if (id == (long) uri)
-        return false;
+    RETURN_IF(id == (long) uri, "Can't delete current kara", false);
     return database_queue_del_id(db, id);
 }
 
@@ -423,41 +334,23 @@ command_move(sqlite3 *db, char *args[LKT_MESSAGE_ARGS_MAX], enum mpd_idle_flag *
     long from, to;
     char *endptr;
 
-    if (args == NULL || args[0] == NULL || args[1] == NULL) {
-        fprintf(stderr, " ! command_move: invalide arguments\n");
-        return false;
-    }
-
+    RETURN_UNLESS(args && args[0] && args[1], "Invalid argument", false);
     errno = 0;
     *watch_mask_ptr |= MPD_IDLE_PLAYLIST;
 
     /* First argument: from */
 
     from = strtol(args[0], &endptr, 10);
-
-    if ((errno == ERANGE && (from == LONG_MAX || from == LONG_MIN)) || (errno != 0 && from == 0)) {
-        fprintf(stderr, " ! command_move: strtol failed: %s\n", strerror(errno));
-        return false;
-    }
-
-    if (endptr == args[0]) {
-        fprintf(stderr, " . command_delid: to digit found in string '%s'\n", args[0]);
-        return false;
-    }
+    RETURN_IF((errno == ERANGE && (from == LONG_MAX || from == LONG_MIN)) || (errno != 0 && from == 0),
+              "Failed: strtol", false);
+    RETURN_IF(endptr == args[0], "No digit found", false);
 
     /* Second argument: to */
 
     to = strtol(args[1], &endptr, 10);
-
-    if ((errno == ERANGE && (to == LONG_MAX || to == LONG_MIN)) || (errno != 0 && to == 0)) {
-        fprintf(stderr, " ! command_move: strtol failed: %s\n", strerror(errno));
-        return false;
-    }
-
-    if (endptr == args[0]) {
-        fprintf(stderr, " . command_delid: to digit found in string '%s'\n", args[1]);
-        return false;
-    }
+    RETURN_IF((errno == ERANGE && (to == LONG_MAX || to == LONG_MIN)) || (errno != 0 && to == 0),
+              "Failed: strtol", false);
+    RETURN_IF(endptr == args[0], "No digit found", false);
 
     return database_queue_move(db, from, to);
 }
@@ -588,10 +481,7 @@ __find(struct lkt_state *srv, size_t c, char *cmd_args[LKT_MESSAGE_ARGS_MAX], lo
 
     /* Check args */
 
-    if (cmd_args == NULL || cmd_args[0] == NULL) {
-        fprintf(stderr, " ! __find: Argument invalid, empty cmd_args\n");
-        return false;
-    }
+    RETURN_UNLESS(cmd_args && cmd_args[0], "Invalid argument", false);
 
     /* Select callback */
 
@@ -639,8 +529,7 @@ __find(struct lkt_state *srv, size_t c, char *cmd_args[LKT_MESSAGE_ARGS_MAX], lo
 
     /* Get the regex */
 
-    if (!cmd_args[1])
-        goto no_rgx;
+    RETURN_UNLESS(cmd_args[1], "No regex", false);
     memset(rgx, 0, PATH_MAX * sizeof(char));
 
     for (int i = 1; cmd_args[i]; ++i) {
@@ -651,19 +540,15 @@ __find(struct lkt_state *srv, size_t c, char *cmd_args[LKT_MESSAGE_ARGS_MAX], lo
 
     /* Make the search langand do the right action */
 
-    if (!init(srv->db, col_name, rgx, &search)) {
-        fprintf(stderr, " ! __find: Failed to init the search\n");
-        return false;
-    }
+    RETURN_UNLESS(init(srv->db, col_name, rgx, &search), "Failed to init search", false);
 
     for (count = 0; database_search_iter(&search); ++count)
         continue;
 
     if (count)
         lkt_set_continuation(srv, c, continuation + count);
+
     return true;
-no_rgx:
-    return false;
 }
 
 bool
@@ -683,8 +568,7 @@ bool
 command_set_playback_option(struct lkt_state *srv, size_t c, enum lkt_playback_option opt,
                             char *args[LKT_MESSAGE_MAX])
 {
-    if (srv == NULL)
-        return false;
+    RETURN_UNLESS(srv, "Invalid argument", false);
 
     (void) c;
     long val, ret = false;
@@ -696,14 +580,9 @@ command_set_playback_option(struct lkt_state *srv, size_t c, enum lkt_playback_o
     else {
         errno = 0;
         val = strtol(args[0], &endptr, 10);
-        if ((errno == ERANGE && (val == LONG_MAX || val == LONG_MIN)) || (errno != 0 && val == 0)) {
-            fprintf(stderr, " ! command_set_playback_option: strtol failed: %s\n", strerror(errno));
-            return false;
-        }
-        if (endptr == args[0]) {
-            fprintf(stderr, " ! command_set_playback_option: strtol failed: %s\n", strerror(errno));
-            return false;
-        }
+        RETURN_IF((errno == ERANGE && (val == LONG_MAX || val == LONG_MIN)) || (errno != 0 && val == 0),
+                  "Failed: strtol", false);
+        RETURN_IF(endptr == args[0], "No digit found", false);
 
         // No values can exceed those boundings, no matter the option //
         if (val < 0)
@@ -739,7 +618,7 @@ command_set_playback_option(struct lkt_state *srv, size_t c, enum lkt_playback_o
     if (ret)
         srv->mpd_idle_events |= MPD_IDLE_OPTIONS;
 
-    return !ret;
+    return ! ret;
 }
 
 bool
@@ -747,27 +626,15 @@ command_set_pos(sqlite3 *db, struct lkt_win *win, enum mpd_idle_flag *watch_mask
 {
     char filepath[PATH_MAX];
     *watch_mask_ptr |= MPD_IDLE_PLAYER;
-
-    if (!database_queue_set_current_index(db, index)) {
-        fprintf(stderr, " ! command_set_pos: Failed to set position in database\n");
-        return false;
-    }
-
-    if (!database_queue_get_current_file(db, filepath)) {
-        fprintf(stderr, " ! command_set_pos: Failed to get filename\n");
-        return false;
-    }
-
+    RETURN_UNLESS(database_queue_set_current_index(db, index), "Failed to set position in queue", false);
+    RETURN_UNLESS(database_queue_get_current_file(db, filepath), "Failed to get filename", false);
     return win->load_file(win, filepath);
 }
 
 bool
 command_plt_add(sqlite3 *db, char *args[LKT_MESSAGE_ARGS_MAX], enum mpd_idle_flag *watch_mask_ptr)
 {
-    if (args == NULL || args[0] == NULL) {
-        fprintf(stderr, " ! command_plt_add: Invalid argument\n");
-        return false;
-    }
+    RETURN_UNLESS(args && args[0], "Invalid argument", false);
 
     bool ret = false;
     struct lkt_uri_t uri;
@@ -803,8 +670,7 @@ command_plt_remove(sqlite3 *db, char *args[LKT_MESSAGE_ARGS_MAX], enum mpd_idle_
     char *endptr;
     long pos;
 
-    if (args == NULL || args[0] == NULL)
-        return false;
+    RETURN_UNLESS(args && args[0], "Invalid argument", false);
 
     if (args[1] == NULL) {
         *watch_mask_ptr |= MPD_IDLE_PLAYLIST;
@@ -812,17 +678,9 @@ command_plt_remove(sqlite3 *db, char *args[LKT_MESSAGE_ARGS_MAX], enum mpd_idle_
     }
 
     pos = strtol(args[1], &endptr, 10);
-
-    if ((errno == ERANGE && (pos == LONG_MAX || pos == LONG_MIN))
-        || (errno != 0 && pos == 0)) {
-        fprintf(stderr, " ! command_plt_remove: strtol failed: %s\n", strerror(errno));
-        return false;
-    }
-
-    if (endptr == args[1]) {
-        fprintf(stderr, " . command_plt_remove: to digit found in string '%s'\n", args[1]);
-        return false;
-    }
+    RETURN_IF((errno == ERANGE && (pos == LONG_MAX || pos == LONG_MIN)) || (errno != 0 && pos == 0),
+              "Failed: strtol", false);
+    RETURN_IF(endptr == args[1], "No digit found", false);
 
     *watch_mask_ptr |= MPD_IDLE_PLAYLIST;
     return database_plt_remove_pos(db, args[0], pos);
@@ -831,26 +689,17 @@ command_plt_remove(sqlite3 *db, char *args[LKT_MESSAGE_ARGS_MAX], enum mpd_idle_
 bool
 command_plt_clear(sqlite3 *db, char *args[LKT_MESSAGE_ARGS_MAX], enum mpd_idle_flag *watch_mask_ptr)
 {
-    if (args == NULL || args[0] == NULL)
-        return false;
-
-    if (!database_plt_clear(db, args[0]))
-        return false;
-
+    RETURN_UNLESS(args && args[0], "Invalid argument", false);
+    RETURN_UNLESS(database_plt_clear(db, args[0]), "Failed to clear playlist", false);
     *watch_mask_ptr |= MPD_IDLE_PLAYLIST;
     return true;
-
 }
 
 bool
 command_plt_rename(sqlite3 *db, char *args[LKT_MESSAGE_ARGS_MAX], enum mpd_idle_flag *watch_mask_ptr)
 {
-    if (args == NULL || args[0] == NULL || args[1] == NULL)
-        return false;
-
-    if (!database_plt_rename(db, args[0], args[1]))
-        return false;
-
+    RETURN_UNLESS(args && args[0] && args[1], "Invalid argument", false);
+    RETURN_UNLESS(database_plt_rename(db, args[0], args[1]), "Failed to rename playlist", false);
     *watch_mask_ptr |= MPD_IDLE_PLAYLIST;
     return true;
 }
@@ -858,18 +707,10 @@ command_plt_rename(sqlite3 *db, char *args[LKT_MESSAGE_ARGS_MAX], enum mpd_idle_
 bool
 command_plt_export(sqlite3 *db, char *args[LKT_MESSAGE_ARGS_MAX], enum mpd_idle_flag *watch_mask_ptr)
 {
-    if (args == NULL || args[0] == NULL || args[1] == NULL)
-        return false;
-
-    if (!database_attach(db, args[0], args[1]))
-        return false;
-
-    if (!database_plt_export(db, args[0]))
-        return false;
-
-    if (!database_detach(db, args[0]))
-        return false;
-
+    RETURN_UNLESS(args && args[0] && args[1], "Invalid argument", false);
+    RETURN_UNLESS(database_attach(db, args[0], args[1]), "Failed to attach database", false);
+    RETURN_UNLESS(database_plt_export(db, args[0]), "Failed to export playlist", false);
+    RETURN_UNLESS(database_detach(db, args[0]), "Failed to detach database", false);
     fprintf(stderr, " * Exported playlist %s with path '%s'\n", args[0], args[1]);
     *watch_mask_ptr |= MPD_IDLE_PLAYLIST;
     return true;
@@ -878,18 +719,10 @@ command_plt_export(sqlite3 *db, char *args[LKT_MESSAGE_ARGS_MAX], enum mpd_idle_
 bool
 command_plt_import(sqlite3 *db, char *args[LKT_MESSAGE_ARGS_MAX], enum mpd_idle_flag *watch_mask_ptr)
 {
-    if (args == NULL || args[0] == NULL || args[1] == NULL)
-        return false;
-
-    if (!database_attach(db, args[0], args[1]))
-        return false;
-
-    if (!database_plt_import(db, args[0]))
-        return false;
-
-    if (!database_detach(db, args[0]))
-        return false;
-
+    RETURN_UNLESS(args && args[0] && args[1], "Invalid argument", false);
+    RETURN_UNLESS(database_attach(db, args[0], args[1]), "Failed to attach database", false);
+    RETURN_UNLESS(database_plt_import(db, args[0]), "Failed to import playlist", false);
+    RETURN_UNLESS(database_detach(db, args[0]), "Failed to detach playlist", false);
     fprintf(stderr, " * Imported playlist %s with path '%s'\n", args[0], args[1]);
     *watch_mask_ptr |= MPD_IDLE_PLAYLIST;
     return true;
@@ -898,34 +731,22 @@ command_plt_import(sqlite3 *db, char *args[LKT_MESSAGE_ARGS_MAX], enum mpd_idle_
 bool
 command_plt_add_uri(sqlite3 *db, char *args[LKT_MESSAGE_ARGS_MAX], enum mpd_idle_flag *watch_mask_ptr)
 {
-    if (args == NULL || args[0] == NULL || args[1] == NULL)
-        return false;
-
+    RETURN_UNLESS(args && args[0] && args[1], "Invalid argument", false);
     struct lkt_uri_t uri;
-
-    if (!lkt_uri_from(&uri, args[1]))
-        return false;
-
+    RETURN_UNLESS(lkt_uri_from(&uri, args[1]), "Failed to parse uri", false);
     bool ret = database_plt_add_uri(db, args[0], &uri);
     lkt_uri_free(&uri);
-
-    if (ret) {
-        *watch_mask_ptr |= MPD_IDLE_PLAYLIST;
-        return true;
-    }
-
-    return false;
+    RETURN_UNLESS(ret, "Failed to add uri to plt", false);
+    *watch_mask_ptr |= MPD_IDLE_PLAYLIST;
+    return true;
 }
 
 bool
 command_shuffle(sqlite3 *db, enum mpd_idle_flag *watch_mask_ptr)
 {
-    if (database_queue_shuffle(db)) {
-        *watch_mask_ptr |= MPD_IDLE_PLAYER;
-        return true;
-    }
-
-    return false;
+    RETURN_UNLESS(database_queue_shuffle(db), "Failed to shuffle", false);
+    *watch_mask_ptr |= MPD_IDLE_PLAYER;
+    return true;
 }
 
 bool
@@ -940,26 +761,15 @@ command_queue_list(struct lkt_state *srv, size_t c, char *args[LKT_MESSAGE_ARGS_
         .c = c,
     };
 
-    if (!args || !args[0] || strlen(args[0]) == 0) {
-        fprintf(stderr, " ! command_queue_list: invalid argument, is empty\n");
-        return false;
-    }
+    RETURN_UNLESS(args && args[0] && strlen(args[0]), "Invalid argument", false);
 
     /* Convert the first integer. */
     errno = 0;
     str = args[0] + strspn(args[0], "-+ "); // Skip not permited chars (NO NEGATIVE!) //
     val = (unsigned int) strtol(str, &endptr, 0);
-
-    if ((errno == ERANGE && (val == LONG_MAX || val == LONG_MIN))
-        || (errno != 0 && val == 0)) {
-        fprintf(stderr, " ! command_queue_list: invalid argument, %s\n", strerror(errno));
-        return false;
-    }
-
-    if (endptr == args[0]) {
-        fprintf(stderr, " ! command_queue_list: invalid argument: no digit found\n");
-        return false;
-    }
+    RETURN_IF((errno == ERANGE && (val == LONG_MAX || val == LONG_MIN)) || (errno != 0 && val == 0),
+              "Invalid argument", false);
+    RETURN_IF(endptr == args[0], "No digit found", false);
 
     from = labs(val);
 
@@ -972,17 +782,9 @@ command_queue_list(struct lkt_state *srv, size_t c, char *args[LKT_MESSAGE_ARGS_
     else {
         str = endptr + strspn(endptr, "-+: "); // NO NEGATIVE! //
         val = strtol(str, &endptr, 0);
-
-        if ((errno == ERANGE && (val == LONG_MAX || val == LONG_MIN))
-            || (errno != 0 && val == 0)) {
-            fprintf(stderr, " ! command_queue_list: invalid argument, %s\n", strerror(errno));
-            return false;
-        }
-
-        if (endptr == args[0]) {
-            fprintf(stderr, " ! command_queue_list: invalid argument: no digit found\n");
-            return false;
-        }
+        RETURN_IF((errno == ERANGE && (val == LONG_MAX || val == LONG_MIN)) || (errno != 0 && val == 0),
+                  "Invalid argument", false);
+        RETURN_IF(endptr == args[0], "No digit found", false);
 
         to = labs(val);
 
@@ -1018,35 +820,18 @@ is_a_range:
 bool
 command_password(struct lkt_state *srv, size_t c, char *argv[LKT_MESSAGE_ARGS_MAX])
 {
-    if (argv[0] == NULL || argv[1] != NULL) {
-        fprintf(stderr, " ! command_password: Invalid arguments, need only one argument\n");
-        return false;
-    }
-
-    if (database_user_authentificate(srv->db, argv[0])) {
-        fprintf(stderr, " . command_password: Authentificate user successfully for client %lu\n", c);
-        lkt_client_auth(srv, c, true);
-        return true;
-    } else {
-        fprintf(stderr, " . command_password: Failed to authentificate client %lu\n", c);
-        return false;
-    }
+    RETURN_UNLESS(argv[0] && !argv[1], "Invalid argument", false);
+    RETURN_UNLESS(database_user_authentificate(srv->db, argv[0]), "Failed to authentificate user", false);
+    lkt_client_auth(srv, c, true);
+    return true;
 }
 
 bool
-command_user_add(sqlite3 *db, char *argv[LKT_MESSAGE_ARGS_MAX])
+command_user_add(struct lkt_state *srv, size_t c, sqlite3 *db, char *argv[LKT_MESSAGE_ARGS_MAX])
 {
-    if (argv[0] == NULL || argv[1] == NULL || argv[2] != NULL) {
-        fprintf(stderr, " ! command_user_add: Invalid arguments, need only two arguments\n");
-        return false;
-    }
-
-    if (database_user_add(db, argv[0], argv[1])) {
-        fprintf(stderr, " . command_user_add: Successfully added user %s\n", argv[0]);
-        return true;
-    }
-
-    fprintf(stderr, " . command_user_add: Failed to add user %s\n", argv[0]);
+    RETURN_UNLESS(argv[0] && argv[1] && !argv[2], "Invalid argument", false);
+    RETURN_UNLESS(lkt_client_auth(srv, c, false), "Failed to authentificate user", false);
+    RETURN_UNLESS(database_user_add(db, argv[0], argv[1]), "Failed to add user", false);
     return false;
 }
 
@@ -1137,45 +922,25 @@ sticker_check_is_present_gt(void *_args, const char *sticker, const char *type,
 bool
 command_sticker_get(struct lkt_state *srv, size_t c, char *argv[LKT_MESSAGE_ARGS_MAX])
 {
-    if (argv[0] == NULL || argv[1] == NULL || argv[2] == NULL || argv[3] != NULL) {
-        fprintf(stderr, " ! command_sticker_get: Invalid argument, need only 3 arguments\n");
-        return false;
-    }
-
+    RETURN_UNLESS(argv[0] && argv[1] && argv[2] && !argv[3], "Invalid argument", false);
     int uri = atoi(argv[1]); /* FIXME: Use strtol. */
-    struct sticker_callback callback = {
+    struct sticker_callback cb = {
         .srv = srv,
         .c = c,
         .call = sticker_send_one_value,
     };
-
-    if (!database_sticker_get(srv->db, argv[0], argv[2], uri, &callback)) {
-        fprintf(stderr, " . command_sticker_get: Failed to get sticker '%s' for object %s(%d)\n",
-                argv[2], argv[0], uri);
-        return false;
-    }
-
+    RETURN_UNLESS(database_sticker_get(srv->db, argv[0], argv[2], uri, &cb), "Failed to get sticker", false);
     return true;
 }
 
 bool
 command_sticker_set(struct lkt_state *srv, size_t c, char *argv[LKT_MESSAGE_ARGS_MAX])
 {
-    if (argv[0] == NULL || argv[1] == NULL || argv[2] == NULL || argv[3] == NULL || argv[4] != NULL) {
-        fprintf(stderr, " ! command_sticker_get: Invalid argument, need only 3 arguments\n");
-        return false;
-    }
-
     (void) c;
+    RETURN_UNLESS(argv[0] && argv[1] && argv[2] && argv[3] && !argv[4], "Invalid argument", false);
     int uri = atoi(argv[1]);    /* FIXME: Use strtol. */
     int value = atoi(argv[4]);  /* FIXME: Use strtol. */
-
-    if (!database_sticker_set(srv->db, argv[0], argv[2], uri, value)) {
-        fprintf(stderr, " . command_sticker_get: Failed to get sticker '%s' to value %d for object "
-                "%s(%d)\n", argv[2], value, argv[0], uri);
-        return false;
-    }
-
+    RETURN_UNLESS(database_sticker_set(srv->db, argv[0], argv[2], uri, value), "Failed to get sticker", false);
     srv->mpd_idle_events |= MPD_IDLE_STICKER;
     return true;
 }
@@ -1252,12 +1017,8 @@ unknown:
 bool
 command_sticker_delete(struct lkt_state *srv, size_t c, char *argv[LKT_MESSAGE_ARGS_MAX])
 {
-    if (argv[0] == NULL || argv[1] == NULL) {
-        fprintf(stderr, " . command_sticker_delete: Invalid argument\n");
-        return false;
-    }
-
     (void) c;
+    RETURN_UNLESS(argv[0] && argv[1], "Invalid argument", false);
     int uri = atoi(argv[1]);
     srv->mpd_idle_events |= MPD_IDLE_STICKER;
     return database_sticker_delete_specify(srv->db, argv[0], uri, argv[2]);
diff --git a/src/net/listen.c b/src/net/listen.c
index 5727ada3116dc8c76f4e6486c59c81ca3a27523b..0c3d28fcb18bbb02b9f11ff82dfce5016244d7e6 100644
--- a/src/net/listen.c
+++ b/src/net/listen.c
@@ -1,6 +1,8 @@
 #define _POSIX_C_SOURCE 200809L
 
 #include <lektor/commands.h>
+#include <lektor/macro.h>
+#include <lektor/defines.h>
 #include <lektor/database.h>
 #include <lektor/repo.h>
 #include <lektor/net.h>
@@ -23,16 +25,6 @@
 #include <unistd.h>
 #include <limits.h>
 
-#ifndef LKT_BACKLOG
-#define LKT_BACKLOG 32
-#endif
-
-#define COMMAND_LIST_MAX 64
-
-#define BUFFER_OUT_MAX 16
-
-#define MPD_VERSION "0.21.16"
-
 enum lkt_command_list_mode {
     LKT_COMMAND_LIST_OFF,
     LKT_COMMAND_LIST_ON,
@@ -85,12 +77,8 @@ void
 lkt_state_send(struct lkt_state *srv, size_t c, struct lkt_message *msg)
 {
     struct lkt_client *cli = &srv->clients[c - 1];
-
-    if (cli->buffer_out_len >= BUFFER_OUT_MAX) {
-        fprintf(stderr, " ! lkt_state_send: cannot send message to client, buffer_out is full.\n");
-        return;
-    }
-
+    RETURN_IF(cli->buffer_out_len >= BUFFER_OUT_MAX, "Cannot send message to client, buffer_out is full",
+              NOTHING);
     cli->buffer_out[cli->buffer_out_len++] = msg;
     srv->fds[c].events |= POLLOUT;
 }
@@ -164,23 +152,15 @@ handle_simple_command(struct lkt_state *srv, size_t c, struct lkt_command cmd)
 
     switch (*lkt_client_get_mask(srv, c)) {
     case MPD_IDLE_NONE:
-        /* Commands that require authentification.
-           TODO: Move authentification verification inside commands. */
-        if (lkt_client_auth(srv, c, false)) {
-            if (!strcmp(cmd.name, "__adduser")) {
-                err = !command_user_add(srv->db, cmd.args);
-                break;
-            } else if (!strcmp(cmd.name, "__restart")) {
-                err = !command_restart(srv, c);
-                break;
-            } else if (!strcmp(cmd.name, "kill")) {
-                err = !command_kill(srv, c);
-                break;
-            } else if (!strcmp(cmd.name, "rescan")) {
-                err = !command_rescan(srv, c, cmd.args);
-                break;
-            }
-        }
+        /* Commands that requires authentification. */
+        if (!strcmp(cmd.name, "__adduser"))
+            err = ! command_user_add(srv, c, srv->db, cmd.args);
+        else if (!strcmp(cmd.name, "__restart"))
+            err = ! command_restart(srv, c);
+        else if (!strcmp(cmd.name, "kill"))
+            err = ! command_kill(srv, c);
+        else if (!strcmp(cmd.name, "rescan"))
+            err = ! command_rescan(srv, c, cmd.args);
 
         /* Commands that are available if not in idle mode */
         if (!strcmp(cmd.name, "currentsong"))
@@ -760,84 +740,45 @@ get_out:
 int
 lkt_listen(void)
 {
+    char *memory = (char *) calloc(2 * PATH_MAX + HOST_NAME_MAX + 3, sizeof(char));
+    RETURN_UNLESS(memory, "Out of memory", 5);
+
     struct lkt_state srv;
     struct lkt_repo repo;
     int autoclear;
-    char *db_path   = (char *) calloc(PATH_MAX, sizeof(char));
-    char *kara_dir  = (char *) calloc(PATH_MAX, sizeof(char));
-    char *host      = (char *) calloc(HOST_NAME_MAX, sizeof(char));
+    char *const db_path  = memory;                  /* Size is PATH_MAX.        */
+    char *const kara_dir = memory + PATH_MAX + 1;   /* Size is PATH_MAX.        */
+    char *const host     = kara_dir + PATH_MAX + 1; /* Size is HOST_NAME_MAX.   */
     char port[7];   /* Maximal port number is 65535, +2 for '\n' and '\0' */
     char player_mod[INI_MAX_LINE];
     char conf_file[PATH_MAX];
     memset(&srv, 0, sizeof(struct lkt_state));
 
     /* Initialize the system. */
-
-    if (!database_new(&srv.db)) {
-        fprintf(stderr, " ! lkt_listen: Failed to initialize memory database\n");
-        return 1;
-    }
-
-    if (config_detect_file(conf_file, PATH_MAX)) {
-        fprintf(stderr, " ! lkt_listen: error while searching for a config file\n");
-        return 1;
-    }
-
-    if (config_new(srv.db, conf_file)) {
-        fprintf(stderr, " ! lkt_listen: failed to read configuration file %s\n", conf_file);
-        return 1;
-    }
+    RETURN_UNLESS(database_new(&srv.db), "Failed to initialize the memory database", 1);
+    RETURN_UNLESS(config_detect_file(conf_file, PATH_MAX), "Failed to find a config file", 1);
+    RETURN_UNLESS(config_new(srv.db, conf_file), "Failed to read configuration file", 1);
 
     /* Finish to initialize. */
-
-    if (!database_config_get_text(srv.db, "database", "db_path", db_path, PATH_MAX)) {
-        fprintf(stderr, " ! lkt_listen: Failed to get database path\n");
-        goto end_free_strings;
-    }
-
-
-    if (!database_open(srv.db, db_path)) {
-        fprintf(stderr, " ! lkt_listen: Failed to open database\n");
-        return 1;
-    }
+    RETURN_UNLESS(database_config_get_text(srv.db, "database", "db_path", db_path, PATH_MAX), "Cfg error", 2);
+    RETURN_UNLESS(database_open(srv.db, db_path), "Can't open database", 1);
 
     /* Read the configuration. */
-
-    if (!database_config_get_int(srv.db, "player", "autoclear", &autoclear)) {
-        fprintf(stderr, " ! Failed to get queue autoclear property\n");
-        return 1;
-    }
-
-    if (!database_config_get_text(srv.db, "database", "kara_dir", kara_dir, PATH_MAX)) {
-        fprintf(stderr, " ! lkt_listen: Failed to get kara directory\n");
-        goto end_free_strings;
-    }
-
-    if (!database_config_get_text(srv.db, "server", "host", host, HOST_NAME_MAX)) {
-        fprintf(stderr, " ! lkt_listen: Failed to get the host\n");
-        goto end_free_strings;
-    }
-
-    if (!database_config_get_text(srv.db, "server", "port", port, 5)) {
-        fprintf(stderr, " ! lkt_listen: Failed to get the port\n");
-        goto end_free_strings;
-    }
-
-    if (!database_config_get_text(srv.db, "player", "module", player_mod, INI_MAX_LINE)) {
-        fprintf(stderr, " ! lkt_listen: Failed to get the module for the player\n");
-        goto end_free_strings;
-    }
+    RETURN_UNLESS(database_config_get_int(srv.db, "player", "autoclear", &autoclear), "Cfg error", 2);
+    RETURN_UNLESS(database_config_get_text(srv.db, "database", "kara_dir", kara_dir, PATH_MAX), "Cfg error", 2);
+    RETURN_UNLESS(database_config_get_text(srv.db, "server", "host", host, HOST_NAME_MAX), "Cfg error", 2);
+    RETURN_UNLESS(database_config_get_text(srv.db, "server", "port", port, 5), "Cfg error", 2);
+    RETURN_UNLESS(database_config_get_text(srv.db, "player", "module", player_mod, INI_MAX_LINE), "Cfg error", 2);
 
     if (kara_dir[strlen(kara_dir) - 1] != '/')
         strncat(kara_dir, "/", PATH_MAX - 1);
 
     srv.kara_prefix = kara_dir;
-
     database_config_queue_default(srv.db);
 
     srv.fds_max = 16;
-    srv.fds = malloc(srv.fds_max * sizeof(struct pollfd));
-    srv.clients = malloc(srv.fds_max * sizeof(struct lkt_client));
+    srv.fds     = calloc(srv.fds_max, sizeof(struct pollfd));
+    srv.clients = calloc(srv.fds_max, sizeof(struct lkt_client));
     memset(srv.clients, 0, srv.fds_max * sizeof(struct lkt_client));
 
     if ((srv.fds[0].fd = init_listening_socket(host, port)) < 0)
@@ -849,17 +790,10 @@ lkt_listen(void)
     if (autoclear)
         database_queue_clear(srv.db);
 
-    if (!load_module_by_name(srv.db, player_mod, &srv.win))
-        return -2;
-
-    if (!srv.win.new(&srv.win))
-        return -2;
-
-    if (repo_new(&repo, "kurisu", "https://kurisu.iiens.net"))
-        return -11;
-
-    if (repo_new_thread(&repo))
-        return -10;
+    RETURN_UNLESS(load_module_by_name(srv.db, player_mod, &srv.win), "Can't load module", 3);
+    RETURN_UNLESS(srv.win.new(&srv.win), "Can't create window", 3);
+    RETURN_IF(repo_new(&repo, "kurisu", "https://kurisu.iiens.net"), "Failed to create repo", 4);
+    RETURN_IF(repo_new_thread(&repo), "Failed to launch repo thread", 4);
 
     for (;;) {
         if (handle_network_events(&srv) < 0)
@@ -874,12 +808,4 @@ lkt_listen(void)
     srv.win.free(&srv.win);
 
     return -1;
-
-    /* End and free strings used to get paths of the database.
-       There was a failure at some point while getting them. */
-end_free_strings:
-    free(kara_dir);
-    free(db_path);
-    free(host);
-    return -10;
 }
diff --git a/src/uri.c b/src/uri.c
index 68d34b210babb154e8c691d602f2e029a7121993..8219ef1a587bd20eb875d1c39363d32327bc45dd 100644
--- a/src/uri.c
+++ b/src/uri.c
@@ -19,10 +19,8 @@ lkt_uri_from(struct lkt_uri_t *ret, char *const str)
     len = strlen(str);
 
     // The minimal uri is id://1 which is a 6 characters long
-    if (len <= 5 * sizeof(char)) {
-        fprintf(stderr, " ! lkt_uri_from: candidate for uri is to short to be an uri: %s\n", str);
+    if (len <= 5 * sizeof(char))
         return false;
-    }
 
     if (!strncasecmp(str, "fs", 2 * sizeof(char))) {
         ret->type = uri_fs;
@@ -48,16 +46,12 @@ lkt_uri_from(struct lkt_uri_t *ret, char *const str)
     } else if (!strncasecmp(str, "query", 5 * sizeof(char))) {
         ret->type = uri_query;
         val = str + 5;
-    } else {
-        fprintf(stderr, " ! lkt_uri_from: unknown uri type for %s\n", str);
+    } else
         return false;
-    }
 
     // No place for the '://' separator
-    if (len - (val - str) < 3) {
-        fprintf(stderr, " ! lkt_uri_from: no separator '://' for uri %s\n", str);
+    if (len - (val - str) < 3)
         return false;
-    }
 
     val += 3;