diff --git a/inc/lektor/module/module_sdl2.h b/inc/lektor/module/module_sdl2.h
index e4a2dd2c8c602baa453b69c8e20233f6e9cbd1e1..9821268e3c973402f26e0a58e7a163320e7b9ffc 100644
--- a/inc/lektor/module/module_sdl2.h
+++ b/inc/lektor/module/module_sdl2.h
@@ -16,6 +16,7 @@ int module_set_function(void *mod, void *handle);
 bool module_sdl2_new(struct lkt_win *const win);
 void module_sdl2_close(struct lkt_win *const win);
 void module_sdl2_free(struct lkt_win *const win);
+void module_sdl2_attach(struct lkt_win *const win, void *server);
 
 bool module_sdl2_toggle_pause(struct lkt_win *const win);
 bool module_sdl2_load_file(struct lkt_win *const win, const char *filepath);
diff --git a/inc/lektor/module/module_x11.h b/inc/lektor/module/module_x11.h
index 880452463c30b72ac7f1e6405a91abf92a6df7ba..16c01718185bdd3e28a1b8c9835de65df21ab7b1 100644
--- a/inc/lektor/module/module_x11.h
+++ b/inc/lektor/module/module_x11.h
@@ -16,6 +16,7 @@ int module_set_function(void *mod, void *handle);
 bool module_x11_new(struct lkt_win *const win);
 void module_x11_close(struct lkt_win *const win);
 void module_x11_free(struct lkt_win *const win);
+void module_x11_attach(struct lkt_win *const win, void *server);
 
 bool module_x11_toggle_pause(struct lkt_win *const win);
 bool module_x11_load_file(struct lkt_win *const win, const char *filepath);
diff --git a/inc/lektor/window.h b/inc/lektor/window.h
index 35d87fbccbab09cdc17f8537d9b87527dc7b0975..69c74ddb96125305927fb27d99b9f45a04925d8e 100644
--- a/inc/lektor/window.h
+++ b/inc/lektor/window.h
@@ -15,9 +15,10 @@ struct lkt_win {
     void *handle;                       /* the libdl handle                                 */
 
     /* Create and free the window */
-    bool (*new)(struct lkt_win *win);   /* Create a window or only the mpv context          */
-    void (*close)(struct lkt_win *win); /* Close the mpv context, not the window.           */
-    void (*free)(struct lkt_win *win);  /* Entirelly liberate all the resources             */
+    bool (*new)(struct lkt_win *win);                   /* Create a window or only the mpv context  */
+    void (*close)(struct lkt_win *win);                 /* Close the mpv context, not the window    */
+    void (*free)(struct lkt_win *win);                  /* Entirelly liberate all the resources     */
+    void (*attach)(struct lkt_win *win, void *server);  /* Get properties from the struct lkt_state */
 
     /* Playback control */
     bool (*toggle_pause)(struct lkt_win *win);
@@ -25,7 +26,6 @@ struct lkt_win {
     bool (*set_volume)(struct lkt_win *win, int vol);
 
     /* Get playback properties */
-    // bool (*is_paused)(struct lkt_win *win, bool *ret);
     bool (*get_duration)(struct lkt_win *win, int *dur_sec);
     bool (*get_elapsed)(struct lkt_win *win, int *elapsed_sec);
 
diff --git a/src/database/open.c b/src/database/open.c
index e27425871c58f447f4d42e94274ad81830e57628..6ad2ee22e4fda1c4cfcebc61bb42e5081e8716e5 100644
--- a/src/database/open.c
+++ b/src/database/open.c
@@ -52,11 +52,10 @@ is_sql_str_invalid(const char *str)
 bool
 database_new(sqlite3 **db)
 {
-    /* SQLITE_OPEN_FULLMUTEX for serialized mode */
-    static int flags = SQLITE_OPEN_READWRITE    |
-                       SQLITE_OPEN_SHAREDCACHE  |
-                       SQLITE_OPEN_NOFOLLOW     |
-                       SQLITE_OPEN_NOMUTEX;
+    static int flags = SQLITE_OPEN_READWRITE    |   /* Open in RW mode              */
+                       SQLITE_OPEN_SHAREDCACHE  |   /* hHared cache for databases   */
+                       SQLITE_OPEN_NOFOLLOW     |   /* Don't follow symlinks        */
+                       SQLITE_OPEN_FULLMUTEX;       /* Serialized                   */
     RETURN_IF(SQLITE_OK != sqlite3_enable_shared_cache(1), "Failed to enable shared cache", false);
     RETURN_IF(sqlite3_soft_heap_limit64(HEAP_LIMIT_SOFT) < 0, "Failed to set soft heap limit", false);
     RETURN_IF(sqlite3_hard_heap_limit64(HEAP_LIMIT_HARD) < 0, "Failed to set soft heap limit", false);
diff --git a/src/module/module_sdl2.c b/src/module/module_sdl2.c
index 6ec3defe8b96ce5667fc47e791bc5cc82ecb62b1..efa57e9e549511a7a2569f4b67a91476158639e4 100644
--- a/src/module/module_sdl2.c
+++ b/src/module/module_sdl2.c
@@ -36,6 +36,10 @@ struct module_sdl2_window {
     mthread_mutex_t mtx;
     struct poller_thread self;
     volatile int launched;  /* SDL you sucks */
+
+    /* Things from the server */
+    volatile sqlite3 *db;
+    volatile enum mpd_idle_flag *mpd_idle_events;
 };
 
 /* Private functions. */
@@ -182,6 +186,11 @@ loop:
             if (flags & MPV_RENDER_UPDATE_FRAME)
                 redraw = 1;
         }
+
+        if (event.type == wakeup_on_mpv_events)
+            lmpv_handle((struct lkt_win *) win, (mpv_handle *) sdl2->mpv, (sqlite3 *) sdl2->db,
+                        (enum mpd_idle_flag *) &sdl2->mpd_idle_events, (int *) &sdl2->mpv_time_pos,
+                        (int *) &sdl2->mpv_duration);
     }
 
     if (redraw) {
@@ -219,16 +228,17 @@ module_set_function(void *arg__, void *handle__)
     RETURN_UNLESS(arg__ && handle__, "Invalid argument", 1);
     struct lkt_win *win = (struct lkt_win *) arg__;
 
-    win->new = module_sdl2_new;
-    win->close = module_sdl2_close;
-    win->free = module_sdl2_free;
-    win->toggle_pause = module_sdl2_toggle_pause;
-    win->load_file = module_sdl2_load_file;
-    win->set_volume = module_sdl2_set_volume;
-    win->get_duration = module_sdl2_get_duration;
-    win->get_elapsed = module_sdl2_get_elapsed;
-    win->handle_events = module_sdl2_handle_events;
-    win->handle = handle__;
+    win->new            = module_sdl2_new;
+    win->close          = module_sdl2_close;
+    win->free           = module_sdl2_free;
+    win->toggle_pause   = module_sdl2_toggle_pause;
+    win->load_file      = module_sdl2_load_file;
+    win->set_volume     = module_sdl2_set_volume;
+    win->get_duration   = module_sdl2_get_duration;
+    win->get_elapsed    = module_sdl2_get_elapsed;
+    win->handle_events  = module_sdl2_handle_events;
+    win->attach         = module_sdl2_attach;
+    win->handle         = handle__;
 
     return 0;
 }
@@ -325,11 +335,21 @@ module_sdl2_get_elapsed(struct lkt_win *const win, int *elapsed_sec)
     return true;
 }
 
+void
+module_sdl2_attach(struct lkt_win *const win, void *server)
+{
+    RETURN_UNLESS(win && server, "Invalid arguments", NOTHING);
+    struct lkt_state *srv = server;
+    struct module_sdl2_window *sdl2 = win->window;
+    sdl2->db = srv->db;
+    sdl2->mpd_idle_events = &srv->mpd_idle_events;
+}
+
 bool
 module_sdl2_handle_events(struct lkt_win *const win, sqlite3 *db, enum mpd_idle_flag *mpd_idle_events)
 {
-    struct module_sdl2_window *sdl2 = win->window;
-    RETURN_UNLESS(sdl2, "Can't handle events from a NULL window", false);
-    return ! lmpv_handle(win, (mpv_handle *) sdl2->mpv, db, mpd_idle_events,
-                         (int *) &sdl2->mpv_time_pos, (int *) &sdl2->mpv_duration);
+    (void) win;
+    (void) db;
+    (void) mpd_idle_events;
+    return true;
 }
diff --git a/src/module/module_x11.c b/src/module/module_x11.c
index a8f821c53b4a4b1aff0ab9ed6b0e1a86e2473e5d..ef28744bcb81c05b1986e374695e6f4bf4851263 100644
--- a/src/module/module_x11.c
+++ b/src/module/module_x11.c
@@ -46,16 +46,17 @@ module_set_function(void *arg__, void *handle__)
     RETURN_UNLESS(arg__ && handle__, "Invalid arguments", 1);
     struct lkt_win *win = (struct lkt_win *) arg__;
 
-    win->new = module_x11_new;
-    win->close = module_x11_close;
-    win->free = module_x11_free;
-    win->toggle_pause = module_x11_toggle_pause;
-    win->load_file = module_x11_load_file;
-    win->set_volume = module_x11_set_volume;
-    win->get_duration = module_x11_get_duration;
-    win->get_elapsed = module_x11_get_elapsed;
-    win->handle_events = module_x11_handle_events;
-    win->handle = handle__;
+    win->new            = module_x11_new;
+    win->close          = module_x11_close;
+    win->free           = module_x11_free;
+    win->toggle_pause   = module_x11_toggle_pause;
+    win->load_file      = module_x11_load_file;
+    win->set_volume     = module_x11_set_volume;
+    win->get_duration   = module_x11_get_duration;
+    win->get_elapsed    = module_x11_get_elapsed;
+    win->handle_events  = module_x11_handle_events;
+    win->attach         = module_x11_attach;
+    win->handle         = handle__;
 
     return 0;
 }
@@ -211,6 +212,13 @@ module_x11_free(struct lkt_win *const win)
     win->window = NULL;
 }
 
+void
+module_x11_attach(struct lkt_win *const win, void *server)
+{
+    (void) win;
+    (void) server;
+}
+
 bool
 module_x11_toggle_pause(struct lkt_win *const win)
 {
diff --git a/src/module/mpv.c b/src/module/mpv.c
index e1d5d09ec81990c4aa2bf5c27cb7fa919377b87d..115bafd8989bcaba20d4716cfbb4f59150a39bdd 100644
--- a/src/module/mpv.c
+++ b/src/module/mpv.c
@@ -133,7 +133,7 @@ lmpv_handle(struct lkt_win *win, mpv_handle *ctx, sqlite3 *db, enum mpd_idle_fla
     struct lkt_queue_state state;
     mpv_event *event = NULL;
     mpv_event_property *prop;
-    RETURN_UNLESS(ctx && win, "Invalid argument", 1);
+    RETURN_UNLESS(db && mpd_idle_events && ctx && win, "Invalid argument", 1);
     RETURN_UNLESS(database_queue_state(db, &state), "Failed to get queue state", 1);
 
 loop:
diff --git a/src/net/listen.c b/src/net/listen.c
index c27977ada5d926b476d3d8685adc4a4dc9aed694..bce45fa800c7f6f6e0e7749a6ec841cf72b4888d 100644
--- a/src/net/listen.c
+++ b/src/net/listen.c
@@ -787,6 +787,7 @@ lkt_listen(void)
 
     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);
+    srv.win.attach(&srv.win, &srv);
     RETURN_IF(repo_new(&srv.repo, "kurisu", "https://kurisu.iiens.net"), "Failed to create repo", 4);
     RETURN_IF(repo_new_thread(&srv.repo), "Failed to launch repo thread", 4);