diff --git a/orgstat.cabal b/orgstat.cabal
--- a/orgstat.cabal
+++ b/orgstat.cabal
@@ -1,5 +1,5 @@
 name:                orgstat
-version:             0.0.2
+version:             0.0.3
 synopsis:            Statistics visualizer for org-mode
 license:             GPL-3
 license-file:        LICENSE
diff --git a/src/OrgStat/Config.hs b/src/OrgStat/Config.hs
--- a/src/OrgStat/Config.hs
+++ b/src/OrgStat/Config.hs
@@ -103,11 +103,13 @@
     parseJSON (String s) | any (`T.isPrefixOf` s) ["day", "week", "month"] = do
         let splitted = T.splitOn "-" $ if "-" `T.isInfixOf` s then s else s <> "-"
             [range, number] = splitted
-            constructor = case range of
-                "day"   -> ConfBlockDay
-                "week"  -> ConfBlockWeek
-                "month" -> ConfBlockMonth
-                _       -> panic "ConfRange@parseJSON"
+            constructor :: (Monad m, MonadFail m) => Integer -> m ConfRange
+            constructor i = case range of
+                "day"   -> pure $ ConfBlockDay i
+                "week"  -> pure $ ConfBlockWeek i
+                "month" -> pure $ ConfBlockMonth i
+                t       -> fail $ "ConfRange@parseJSON can't parse " <> T.unpack t <>
+                                  " should be [day|week|month]"
             numberParsed
                 | number == "" = pure 0
                 | otherwise = case readMaybe (T.unpack number) of
@@ -116,7 +118,7 @@
         when (length splitted /= 2) $
             fail $ "Couldn't parse range " <> T.unpack s <>
                    ", splitted is " <> show splitted
-        constructor <$> numberParsed
+        constructor =<< numberParsed
     parseJSON (Object v)       = ConfFromTo <$> v .: "from" <*> v .: "to"
     parseJSON invalid          = typeMismatch "ConfRange" invalid
 
diff --git a/src/OrgStat/Logic.hs b/src/OrgStat/Logic.hs
--- a/src/OrgStat/Logic.hs
+++ b/src/OrgStat/Logic.hs
@@ -39,17 +39,17 @@
 convertRange :: (MonadIO m) => ConfRange -> m (LocalTime, LocalTime)
 convertRange range = case range of
     (ConfFromTo f t)  -> (,) <$> fromConfDate f <*> fromConfDate t
-    (ConfBlockDay i) | i < 0 -> panic $ "ConfBlockDay i is <0: " <> show i
+    (ConfBlockDay i) | i < 0 -> error $ "ConfBlockDay i is <0: " <> show i
     (ConfBlockDay 0) -> (,) <$> (localFromDay <$> startOfDay) <*> curTime
     (ConfBlockDay i) -> do
         d <- (negate (i - 1) `addDays`) <$> startOfDay
         pure $ localFromDayPair ((negate 1) `addDays` d, d)
-    (ConfBlockWeek i) | i < 0 -> panic $ "ConfBlockWeek i is <0: " <> show i
+    (ConfBlockWeek i) | i < 0 -> error $ "ConfBlockWeek i is <0: " <> show i
     (ConfBlockWeek 0) -> (,) <$> (localFromDay <$> startOfWeek) <*> curTime
     (ConfBlockWeek i) -> do
         d <- (negate (i - 1) `addWeeks`) <$> startOfWeek
         pure $ localFromDayPair ((negate 1) `addWeeks` d, d)
-    (ConfBlockMonth i) | i < 0 -> panic $ "ConfBlockMonth i is <0: " <> show i
+    (ConfBlockMonth i) | i < 0 -> error $ "ConfBlockMonth i is <0: " <> show i
     (ConfBlockMonth 0) -> (,) <$> (localFromDay <$> startOfMonth) <*> curTime
     (ConfBlockMonth i) -> do
         d <- addGregorianMonthsRollOver (negate $ i-1) <$> startOfMonth
@@ -91,7 +91,7 @@
             scope <- getScope conf timelineScope crName
             let scopeFiles = NE.toList $ csPaths scope
                 neededOrgs =
-                    map (\f -> fromMaybe (panic $ scopeNotFound (T.pack f) crName) $
+                    map (\f -> fromMaybe (error $ scopeNotFound (T.pack f) crName) $
                                M.lookup f allParsedOrgs)
                         scopeFiles
             let orgTop = Org "/" [] [] $ map (\(fn,o) -> o & orgTitle .~ fn) neededOrgs
diff --git a/src/OrgStat/Scope.hs b/src/OrgStat/Scope.hs
--- a/src/OrgStat/Scope.hs
+++ b/src/OrgStat/Scope.hs
@@ -94,7 +94,7 @@
     unless (existsPath path org) $
         throwError $ MEWrongParam m $ "Path " <> show path <> " doesn't exist"
     pure $
-        fromMaybe (panic "applyModifier@ModSelectSubtree is broken") $
+        fromMaybe (error "applyModifier@ModSelectSubtree is broken") $
         org ^. atPath path
 applyModifier _ org = pure org -- TODO
 
diff --git a/src/OrgStat/Util.hs b/src/OrgStat/Util.hs
--- a/src/OrgStat/Util.hs
+++ b/src/OrgStat/Util.hs
@@ -63,7 +63,7 @@
 hashColour :: (Hashable a) => Int -> a -> Colour Double
 hashColour salt item = colours !! (hashWithSalt salt item `mod` length colours)
   where
-    broken = panic "Util#hashColour is broken"
+    broken = error "Util#hashColour is broken"
     range = [-5,0,5]
     colours = filter (\c -> luminance c < 0.8 && luminance c > 0.06) mutate
     ac :: Word8 -> Integer -> Word8
