diff --git a/app/Main.hs b/app/Main.hs
index d9e15a5da4a15c4eec5dce970ea543c486974448..8971411d1ed8a642b95b6c3cb75b4612fee84d98 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -1,17 +1,8 @@
 module Main where
 
 import QBar.Cli
-import QBar.ControlSocket
 import QBar.DefaultConfig
-import QBar.Filter
 import QBar.Server
 
 main :: IO ()
-main = parseOptions >>= runQBar
-
-runQBar :: MainOptions -> IO ()
-runQBar options@MainOptions{barCommand} = runCommand barCommand
-  where
-    runCommand BarServer = runBarConfiguration generateDefaultBarConfig options
-    runCommand NoFilter = sendIpc options $ SetFilter $ StaticFilter None
-    runCommand RainbowFilter = sendIpc options $ SetFilter $ AnimatedFilter Rainbow
\ No newline at end of file
+main = parseOptions >>= (runQBar generateDefaultBarConfig)
\ No newline at end of file
diff --git a/src/QBar/Core.hs b/src/QBar/Core.hs
index f95ddbb8f57099a4fecebd7706bda8ebffa322b0..f3d131b2d1a2198a7c1ab099c92fc8cc607c6efd 100644
--- a/src/QBar/Core.hs
+++ b/src/QBar/Core.hs
@@ -78,6 +78,9 @@ data BarUpdateChannel = BarUpdateChannel (IO ())
 type BarUpdateEvent = Event.Event
 
 
+type BarConfiguration = BarUpdateChannel -> Producer CachedBlock IO ()
+
+
 defaultColor :: T.Text
 defaultColor = "#969896"
 
diff --git a/src/QBar/Server.hs b/src/QBar/Server.hs
index 474f59add211d7bae8ebf4f6918ce68d91f95866..c5769ed4e7928b7dd094405bd997c00a4ef0c61d 100644
--- a/src/QBar/Server.hs
+++ b/src/QBar/Server.hs
@@ -211,4 +211,12 @@ runBarConfiguration generateBarConfig options = do
   renderLoop options handle barUpdateEvent initialOutput newBlockProducers
 
 createCommandChan :: IO CommandChan
-createCommandChan = newTChanIO
\ No newline at end of file
+createCommandChan = newTChanIO
+
+-- |Entry point.
+runQBar :: BarConfiguration -> MainOptions -> IO ()
+runQBar barConfiguration options@MainOptions{barCommand} = runCommand barCommand
+  where
+    runCommand BarServer = runBarConfiguration barConfiguration options
+    runCommand NoFilter = sendIpc options $ SetFilter $ StaticFilter None
+    runCommand RainbowFilter = sendIpc options $ SetFilter $ AnimatedFilter Rainbow
\ No newline at end of file