diff --git a/src/clock.vala b/src/clock.vala
index 6071c10..32bb696 100644
--- a/src/clock.vala
+++ b/src/clock.vala
@@ -25,6 +25,8 @@ public enum PanelId {
     TIMER,
 }
 
+public static const int N_PANELS = 4;
+
 public interface Clock : GLib.Object {
     public abstract string label { get; protected construct set; }
     public abstract HeaderBar header_bar { get; protected construct set; }
diff --git a/src/window.vala b/src/window.vala
index 550710c..c274ba5 100644
--- a/src/window.vala
+++ b/src/window.vala
@@ -31,11 +31,8 @@ public class Window : Gtk.ApplicationWindow {
 
     private HeaderBar header_bar;
     private Gd.Stack stack;
-    private World.MainPanel world;
-    private Alarm.MainPanel alarm;
-    private Stopwatch.MainPanel stopwatch;
-    private Timer.MainPanel timer;
     private GLib.Settings settings;
+    private Gtk.Widget[] panels;
 
     public Window (Application app) {
         Object (application: app, title: _("Clocks"));
@@ -61,15 +58,16 @@ public class Window : Gtk.ApplicationWindow {
         header_bar = builder.get_object ("header_bar") as HeaderBar;
         stack = builder.get_object ("stack") as Gd.Stack;
 
-        world = new World.MainPanel (header_bar);
-        alarm = new Alarm.MainPanel (header_bar);
-        stopwatch = new Stopwatch.MainPanel (header_bar);
-        timer = new Timer.MainPanel (header_bar);
+        panels = new Gtk.Widget[N_PANELS];
 
-        stack.add_titled (world, world.label, world.label);
-        stack.add_titled (alarm, alarm.label, alarm.label);
-        stack.add_titled (stopwatch, stopwatch.label, stopwatch.label);
-        stack.add_titled (timer, timer.label, timer.label);
+        panels[PanelId.WORLD] = new World.MainPanel (header_bar);
+        panels[PanelId.ALARM] =  new Alarm.MainPanel (header_bar);
+        panels[PanelId.STOPWATCH] = new Stopwatch.MainPanel (header_bar);
+        panels[PanelId.TIMER] = new Timer.MainPanel (header_bar);
+
+        foreach (var clock in panels) {
+            stack.add_titled (clock, ((Clock)clock).label, ((Clock)clock).label);
+        }
 
         header_bar.set_stack (stack);
 
@@ -88,29 +86,15 @@ public class Window : Gtk.ApplicationWindow {
             stack_id = 0;
         });
 
-        alarm.ring.connect ((w) => {
+        ((Alarm.MainPanel)panels[PanelId.ALARM]).ring.connect ((w) => {
             stack.visible_child = w;
         });
 
-        timer.ring.connect ((w) => {
+        ((Timer.MainPanel)panels[PanelId.TIMER]).ring.connect ((w) => {
             stack.visible_child = w;
         });
 
-        PanelId panel_id = (PanelId)settings.get_enum ("panel-id");
-        switch (panel_id) {
-        case PanelId.WORLD:
-            stack.visible_child = world;
-            break;
-        case PanelId.ALARM:
-            stack.visible_child = alarm;
-            break;
-        case PanelId.STOPWATCH:
-            stack.visible_child = stopwatch;
-            break;
-        case PanelId.TIMER:
-            stack.visible_child = timer;
-            break;
-        }
+        stack.visible_child = panels[settings.get_enum ("panel-id")];
 
         update_header_bar ();
 
