diff --git a/CHANGELOG b/CHANGELOG
new file mode 100644
--- /dev/null
+++ b/CHANGELOG
@@ -0,0 +1,61 @@
+TODO
+	check Spanish: 21 (las? la?), halves
+	timer for Danish, Greek and Spanish
+	halv midnatt -> Swedish
+	config file (+ when to play the sound/s)
+	read default language from $LANG (hFlush!)
+	daemon?
+
+0.7.3	2011.04.22
+	added Swedish (thanks Closey)
+
+0.7.2	2011.04.17
+	added case control
+
+0.7.1
+	improved cabal
+
+0.7		2011.01.24
+	added Norwegian (thanks arnvidr)
+	added timer for Dutch (thanks Boris27) and German (thanks marens and ichbinsisyphos)
+	added Danish style 2
+	added German style 3 (thanks marens and ichbinsisyphos)
+	added Spanish style 3 (thanks xenofungus)
+	added timer alarm sound
+	fixed exit codes
+
+0.6		2011.01.21
+	added the timer mode (en, fr, pl and tr)
+	added Spanish (thanks itsbrad212)
+	fixed the almost-next-hour bug
+
+0.5		2011.01.17
+	added halves as base (de, nl and pl)
+	added Greek (thanks Gbak), Dutch (thanks litemotiv) and Turkish
+	some corrections (thanks Daniel Fischer from beginners@haskell.org again)
+
+0.4.1	2011.01.15
+	fixed nextFTHour
+
+0.4		2011.01.15
+	added --time (thanks Daniel Fischer and Brent Yorgey from beginners@haskell.org!)
+	added --style
+	added Danish (by M_ller with my modifications)
+	removed "południe" from pl
+	sorted out the representation of midnight and noon
+	added a man page
+
+0.3		2011.01.14
+	added midnight and noon
+	added checking cli options
+	fixed the "quarter past quarter" bug
+
+0.2		2011.01.12
+	added French and German
+	added 12 vs. 24-hour clock
+
+0.1.1	2010.12.06
+	added cabal
+
+0.1		2010.12.05
+	initial release: two languages (en and pl), 1 < precision < 60
diff --git a/INSTALL b/INSTALL
new file mode 100644
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,16 @@
+fuzzytime 0.7.3 (2011.04.22)
+A clock and timer that tell the time in a more human way (the 'ten past six'-style)
+
+
+DEPENDENCIES:
+– The Glasgow Haskell Compiler (http://www.haskell.org/ghc/)
+– CmdArgs (http://community.haskell.org/~ndm/cmdargs/)
+
+OPTIONAL DEPENDENCIES:
+– alsa-utils (aplay) to play the timer alarm sound
+
+
+INSTALL:
+runhaskell Setup.hs configure --prefix=/usr --docdir=/usr/share/doc/$pkgname -O
+runhaskell Setup.hs build
+runhaskell Setup.hs install
diff --git a/README b/README
new file mode 100644
--- /dev/null
+++ b/README
@@ -0,0 +1,38 @@
+### DESCRIPTION
+
+fuzzytime is a small utility which tells what time it is or how much time there is left to something, in a more familiar way such as "ten to six" rather than 17:51 (telling the time), or "in five minutes" (telling the left time).
+
+There are two modes: telling the time / the time left till some event, and setting the timer. See main below.
+
+The intended use is in an environment which does not provide a status bar with a built-in clock. It is expected to be piper to a status bar and run every minute or so in the clock mode.
+The timer can be set via the timer-setting mode. When the timer is set, the clock mode will show how much time there is left till some event. To get back to showing the actual time, timer has to be unset.
+
+
+### EXAMPLE USE
+
+Say you have fuzzytime piped to your status bar and it serves as a usual clock applet. Then you got an e-mail saying that you're going to have a meeting at one o'clock. You set the timer to 13:00 and instead of the current time, fuzzytime begins to show you how much time you have left till the meeting. After you come back, you unset the timer and have fuzzytime display the current time again.
+
+
+### --help
+A clock and timer that tell the time in a more human way.
+v0.7.3, 2011.04.22, *antispam*, GPL3+
+
+fuzzytime [COMMAND] ... [OPTIONS]
+
+Common flags:
+  -? --help       Display help message
+  -V --version    Print version information
+
+fuzzytime clock [OPTIONS]
+  Print fuzzy time if timer is not set, and countdown if it is.
+
+     --caps=INT   Capital letters; default 1 (see the man page).
+  -c --clock=INT  12 or 24-hour clock; default 12-hour.
+  -l --lang=ITEM  Language (currently da, de, el, en, es, fr, nb, nl, pl, se
+                  and tr); default en.
+  -p --prec=INT   Precision (1 <= prec <= 60 [minutes]); default 5.
+  -t --time=ITEM  Time to fuzzify as HH:MM; default current time.
+  -s --style=INT  How the time is told (see the man page); default 1.
+
+fuzzytime timer [OPTIONS] [END]
+  Set timer to END as HH:MM or "unset". (Disables printing time.)
diff --git a/fuzzytime.cabal b/fuzzytime.cabal
--- a/fuzzytime.cabal
+++ b/fuzzytime.cabal
@@ -1,15 +1,30 @@
-Name:                fuzzytime
-Version:             0.7
-Description:         A clock and timer that tell the time in a more human way
-Synopsis:            A clock and timer that tell the time in a more human way
-Category:            Utils
-License:             GPL
-License-file:        LICENSE
-Author:              Kamil Stachowski
-Maintainer:          kamil.stachowski@gmail.com
-Build-Type:          Simple
-Cabal-Version:       >=1.8
+name:                fuzzytime
+version:             0.7.3
+description:         A clock and timer that tell the time in a more human way
+synopsis:            A clock and timer that tell the time in a more human way
+category:            Utils
+license:             GPL
+license-file:        LICENSE
+author:              Kamil Stachowski
+maintainer:          kamil.stachowski@gmail.com
+build-type:          Simple
+stability:           Experimental
+cabal-version:       >=1.8
+tested-with:         GHC == 7.0.2
+extra-source-files:  CHANGELOG, INSTALL, README, src/fuzzytime.1, src/sound.wav
 
-Executable fuzzytime
-    Main-is:           fuzzytime.hs
-    Build-Depends:     base >= 4 && < 5, cmdargs, haskell98, old-time, process
+
+library
+    buildable:       True
+    build-depends:   base >= 4 && < 5
+    exposed-modules: FuzzyTime
+    hs-source-dirs:  src
+    ghc-options:     -O2
+
+executable fuzzytime
+    buildable:       True
+    main-is:         fuzzytime.hs
+    build-depends:   base >= 4 && < 5, cmdargs, haskell98, old-time, process
+    hs-source-dirs:  src
+    -- ghc-options:     -Wall -O2
+    ghc-options:     -O2
diff --git a/fuzzytime.hs b/fuzzytime.hs
deleted file mode 100644
--- a/fuzzytime.hs
+++ /dev/null
@@ -1,269 +0,0 @@
-{- |
-fuzzytime is a small utility which tells what time it is or how much time there is left till something happens, in a more familiar way such as "ten to six" rather than 17:51 (telling the time), or "in five minutes" (telling the left time).
-
-There are two modes: telling the time / the time left till some event, and setting the timer. See main below.
-
-The intended use is in an environment which does not provide a status bar with a built-in clock. It is expected to be piper to a status bar and run every minute or so in the clock mode.
-The timer can be set via the timer-setting mode. When the timer is set, the clock mode will show how much time there is left till some event. To get back to showing the actual time, timer has to be unset.
-
-Example use:
-Say you have fuzzytime piped to your status bar and it serves as a usual clock applet. Then you got an e-mail saying that you're going to have a meeting at one o'clock. You set the timer to 13:00 and instead of the current time, fuzzytime begins to show you how much time you have left till the meeting. After you come back, you unset the timer and have fuzzytime display the current time again.
-
-More technically, this module provides an interface to FuzzyTime which does all the conversion from time to string.
-
-Depends on N. Mitchell's System.Console.CmdArds 0.6.4-1+.
-
-To add a new language, two things need to be done:
-(1) The new language needs to be added to confAvailLangs in fuzzytime.hs.
-(2) A module FuzzyTime.NewLanguge needs to be created and added to the list of imports and to the instance Show FuzzyTime in FuzzyTime.hs.
--}
-
-
--- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
----- |
----- Module			: Main
----- Copyright		: (C) Kamil Stachowski <kamil.stachowski@gmail.com>
----- License		: GPL3+
----- Maintainer		: Kamil Stachowski <kamil.stachowski@gmail.com>
----- Stability		: unstable
----- Portability	: unportable
----- A clock that ells the time in a more human way (the \"ten past six\"-style).
--- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-
-
-{-# LANGUAGE DeriveDataTypeable #-}
-
-module Main (
-	  main
-	) where
-
-
-import Control.Monad (when)
-import Data.Char (isDigit)
-import Data.List (intercalate)
-import Directory (removeFile)
-import System.Cmd (system)
-import System.Console.CmdArgs
-import System.Environment (getEnv)
-import System.Exit (ExitCode (ExitFailure), exitFailure)
-import System.Time (getClockTime)
-
-import FuzzyTime
-
-
--- config =========================================================================================================================================================================
-
--- available ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
-
-
--- | \[config] Languages available.
-confAvailLangs :: [String]
-confAvailLangs = ["da", "de", "el", "en", "es", "fr", "nb", "nl", "pl", "tr"]
-
-
--- defaults -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
-
-
--- | \[config] The default language.
-confDefLang :: String
-confDefLang = "en"
-
--- | \[config] The default clock (12 vs. 24-hour) for the clock mode.
-confDefClockClock :: Int
-confDefClockClock = 12
-
--- | \[config] The default precision (should be in [1..60]) for the clock mode.
-confDefClockPrec :: Int
-confDefClockPrec = 5
-
--- | \[config] The default style for the clock mode (see the man page).
-confDefClockStyle :: Int
-confDefClockStyle = 1
-
-
--- | \[config] Get the default config for showing the time.
-getDefClockConf :: IO FuzzyTimeConf
-getDefClockConf = do
-	nowClock <- getClockTime
-	let nowString = take 5 . drop 11 $ show nowClock
-	return $ ClockConf {
-		  clock	= confDefClockClock	&= help confHelpClockClock
-		, lang	= confDefLang		&= help confHelpClockLang
-		, prec	= confDefClockPrec	&= help confHelpClockPrec
-		, time	= nowString			&= help confHelpClockTime
-		, style	= confDefClockStyle	&= help confHelpClockStyle
-		} &= name "clock" &= help confHelpClock
-
--- | \[config] Get the default config for either showing the time or setting the timer.
-getDefTimerConf :: IO FuzzyTimeConf
-getDefTimerConf = do
-	nowClock <- getClockTime
-	let nowString = take 5 . drop 11 $ show nowClock
-	endFile <- (readFile =<< confTimerFileLoc) `catch` (\_ -> return "empty")
-	let endString = take 5 endFile
-	return $ TimerConf {
-		  end	= endString			&= args &= typ "END"
-		, lang	= confDefLang		&= ignore				-- will be taken from ClockConf anyway
-		, now	= nowString			&= ignore				-- will be taken from ClockConf anyway
-		} &= name "timer" &= help confHelpTimer
-
-
--- internal -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
-
-
--- | \[config] The default location for the timer file.
-confTimerFileLoc :: IO String
-confTimerFileLoc = do
-	home <- getEnv "HOME"
-	return $ home ++ "/.fuzzytimer"
-
-
--- | \[config] The default command for playing the timer sound.
-confTimerSoundCmd :: String
-confTimerSoundCmd = "aplay /usr/share/fuzzytime/sound.wav &> /dev/null"
-
-
--- | Print nicely what languages are available.
-showAvailLangs :: String -> String
-showAvailLangs i = case length confAvailLangs of
-						0	-> "none"
-						1	-> head confAvailLangs
-						_	-> intercalate ", " (init confAvailLangs) ++ " " ++ i ++ " " ++ last confAvailLangs
-
-
--- help ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-
-
--- | \[config] Help message for the clock (showing) mode.
-confHelpClock :: String
-confHelpClock = "Print fuzzy time if timer is not set, and countdown if it is."
-
--- | \[config] Help message for --clock.
-confHelpClockClock :: String
-confHelpClockClock = "12 or 24-hour clock; default " ++ show confDefClockClock ++ "-hour."
-
--- | \[config] Help message for --lang.
-confHelpClockLang :: String
-confHelpClockLang = "Language (currently " ++ showAvailLangs "and" ++ "); default " ++ confDefLang ++ "."
-
--- | \[config] Help message for --prec.
-confHelpClockPrec :: String
-confHelpClockPrec = "Precision (1 <= prec <= 60 [minutes]); default " ++ show confDefClockPrec ++ "."
-
--- | \[config] Help message for --time.
-confHelpClockTime :: String
-confHelpClockTime = "Time to fuzzify as HH:MM; default current time." 
-
--- | \[config] Help message for --style.
-confHelpClockStyle :: String
-confHelpClockStyle = "How the time is told (seem the man page); default " ++ show confDefClockStyle ++ "."
-
-
--- | \[config] Help message for the timer (setting) mode.
-confHelpTimer :: String
-confHelpTimer = "Set timer to END as HH:MM or \"unset\". (Disables printing time.)"
-
--- | \[config] Help message for END.
-confHelpTimerEnd :: String
-confHelpTimerEnd = "Set the timer to countdown to END as HH:MM; obligatory."
-
-
--- | \[config] Help message for program
-confHelpProgram :: String
-confHelpProgram = "fuzzytime"
-
--- | \[config] Help message for summary
-confHelpSummary :: String
-confHelpSummary = "A clock and timer that tell the time in a more human way.\nv0.7, 2011.01.24, kamil.stachowski@gmail.com, GPL3+"
-
-
--- check --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-
-
--- | \[config] Check that arguments given at cli or read from the timer file are correct.
-checkFTConf :: FuzzyTimeConf -> Either String FuzzyTimeConf
-
-checkFTConf c@(ClockConf clock lang prec time style)
-	| clock `notElem` [12, 24]	= Left "--clock must be either 12 or 24."
-	| lang `notElem` confAvailLangs = Left ("--lang must be " ++ showAvailLangs "or" ++ ".")
-	| prec < 1 || prec > 60		= Left "--prec must be in [1..60]."
-	| not (checkTimeOk time)	= Left "--time must be given as HH:MM, where HH is in [0..23] and MM is in [0..59]."
-	| style < 1 || style > 3	= Left "--style must be in [1..3] (see the man page)."
-	| otherwise					= Right c
-
-checkFTConf t@(TimerConf end lang now)
-	| not (checkTimeOk end)
-		&& end /= "unset"		= Left "END must be given and in the same format as --time."
-	| not (checkTimeOk now)		= Left "--time must be given as HH:MM, where HH is in [0..23] and MM is in [0..59]."
-	| otherwise					= Right t
-
-
--- | \[config] Check that a string is a properly formatted time (HH:MM).
-checkTimeOk :: Time -> Bool
-checkTimeOk time = case break (== ':') time of
-	(hh, _:mm)	->	not (null hh || null mm)
-					&& all isDigit hh && all isDigit mm
-					&& (let h = read hh; m = read mm
-						in 0 <= h && h < 24 && 0 <= m && m < 60)
-	_			->	False
-
-
--- other --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-
-
-exitWithError :: String -> IO ()
-exitWithError error = do
-	putStrLn error
-	exitFailure
-
-
--- main ===========================================================================================================================================================================
-
-
--- | There are two modes: telling the time, and setting the timer.
--- Telling the time happens when invoked as "fuzzytime clock". If the timer is set (if ~/.fuzzytimer exists), the countdown is shown. Otherwise, time is shown.
--- Setting the timer happens when invoked as "fuzzytime timer END", where END can be either the time to countdown to (as HH:MM), or "unset" to disable the timer.
--- Note that they are different from the two modes of FuzzyTime: telling the time can invoke both FuzzyTime's ClockConf and TimerConf, and setting the timer only happens here.
-main :: IO ()
-main = do
-	clockConf <- getDefClockConf
-	timerConf <- getDefTimerConf
-	conf <- cmdArgs (modes [clockConf, timerConf] &= program confHelpProgram &= summary confHelpSummary)
-	case conf of
-		cc@(ClockConf _ _ _ _ _)	-> runModeShow $ if end timerConf == "empty" then
-														conf
-														else
-														timerConf {
-															lang = lang conf,
-															now = time conf
-														}
-		tc@(TimerConf _ _ _)		-> runModeTimer tc
-
-
--- modes --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-
-
--- | The time-showing mode.
-runModeShow :: FuzzyTimeConf -> IO ()
-runModeShow conf =
-	case checkFTConf conf of
-		Left e	->	exitWithError e
-		Right c	->	do
-					let time = toFuzzyTime c
-					when (isTimerZero time) (do system confTimerSoundCmd; return ())
-					print time
-
-
--- | The timer-setting mode.
-runModeTimer :: FuzzyTimeConf -> IO ()
-runModeTimer conf@(TimerConf end _ _) =
-	case checkFTConf conf of
-		Left e	-> 	exitWithError e
-		Right c	->	do
-					path <- confTimerFileLoc
-					removeFile path `catch` (\_ -> return ())
-					if end == "unset" then
-						putStrLn "Timer has been unset."
-						else do
-						writeFile path end
-						putStrLn $ "Timer has been set to " ++ end ++ "."
diff --git a/src/FuzzyTime.hs b/src/FuzzyTime.hs
new file mode 100644
--- /dev/null
+++ b/src/FuzzyTime.hs
@@ -0,0 +1,185 @@
+{- |
+In this module the actual conversion from time to string happens.
+
+There are two modes, showing the time and showing the time left till something. This is represented by the duality of both FuzzyTimeConf and FuzzyTime: ClockConf and FuzzyClock serve to show the time, while TimerConf and FuzzyTimer are used for counting down.
+
+A FuzzyTime is created from a FuzzyTimeConf with toFuzzyTime. It is translated to a string via show.
+
+Apart from the above, two functions are exported: isTimerZero which can be used by an interface to set off the alarm when timer reaches zero, and nextFTHour which makes sure that the clock is a circular data structure.
+-}
+
+
+{-# LANGUAGE DeriveDataTypeable #-}
+
+module FuzzyTime (
+	  FuzzyTime (..)
+	, capsizeDef
+	, toFuzzyTime
+	, isTimerZero
+	, nextFTHour
+	, FuzzyTimeConf (..)
+	, Time
+	) where
+
+
+import Data.Char (toLower, toUpper)
+import Data.Data
+import Data.List (intersperse)
+import Prelude hiding (min)
+
+import FuzzyTime.Danish
+import FuzzyTime.Dutch
+import FuzzyTime.English
+import FuzzyTime.German
+import FuzzyTime.Greek
+import FuzzyTime.French
+import FuzzyTime.Norwegian
+import FuzzyTime.Polish
+import FuzzyTime.Spanish
+import FuzzyTime.Swedish
+import FuzzyTime.Turkish
+
+
+-- FuzzyTime =======================================================================================================================================================================
+
+
+-- | Convenience alias.
+type Time = String
+
+
+
+-- | Data for fuzzified time. There are two modes: FuzzyClock for showing what time it is and FuzzyTimer for showing how much time there is left till something. The String output is obtained via Show.
+data FuzzyTime
+	= FuzzyClock {
+	  ftAm		:: Bool
+	, ftCaps	:: Int
+	, ftClock	:: Int
+	, ftHour	:: Int
+	, ftLang	:: String
+	, ftMin		:: Int
+	, ftStyle	:: Int
+	}
+	| FuzzyTimer {
+	  ftLang	:: String
+	, ftMins	:: Int
+	}
+	deriving Eq
+
+
+-- | This is where FuzzyTime is turned into the time String.
+-- It is assumed that by the time these functions are called, hour will be in [0..23] and min will be in [0..59].
+instance Show FuzzyTime where
+	show ft = case ftLang ft of
+		"da" -> showFuzzyTimeDa ft
+		"de" -> showFuzzyTimeDe ft
+		"el" -> showFuzzyTimeEl ft
+		"en" -> showFuzzyTimeEn ft
+		"es" -> showFuzzyTimeEs ft
+		"fr" -> showFuzzyTimeFr ft
+		"nb" -> showFuzzyTimeNb ft
+		"nl" -> showFuzzyTimeNl ft
+		"pl" -> showFuzzyTimePl ft
+		"se" -> showFuzzyTimeSe ft
+		"tr" -> showFuzzyTimeTr ft
+		_ -> "Language " ++ ftLang ft ++ " is not supported."
+
+
+-- | Turns a FuzzyTimeConf into a FuzzyTime. Works for both FuzzyClock and FuzzyTimer.
+-- In the clock mode, am (Bool), clock (12 vs. 24-hour), language and style are set apart from the actual time, so that show knows how to display the time.
+-- In the timer mode, only language and left minutes need to be set.
+toFuzzyTime :: FuzzyTimeConf -> FuzzyTime
+toFuzzyTime ftc = case ftc of
+	(ClockConf caps clock lang prec time style)
+		-> FuzzyClock am caps clock fuzzdHour lang fuzzdMin style
+			where
+			fuzzdHour :: Int
+			fuzzdHour = let hh = if min+prec>=60 && fuzzdMin==0 then hour+1 else hour in
+				if clock==24 then
+					if hh==0 then 24 else hh
+				else
+					if hh==12 then hh else hh `mod` 12
+			fuzzdMin :: Int
+			fuzzdMin =
+				let
+					mf = fromIntegral min :: Float
+					cf = fromIntegral prec :: Float
+				in
+					(round(mf/cf) * prec) `mod` 60
+			hour :: Int
+			hour = read $ fst (break (==':') time)
+			min :: Int
+			min = read $ drop 1 $ snd (break (==':') time)
+			am :: Bool
+			am = hour < 12
+	(TimerConf end lang now)
+		-> FuzzyTimer lang fuzzdMins
+			where
+			fuzzdMins :: Int
+			fuzzdMins = 
+				let
+					mf = fromIntegral minsDiff :: Float
+					cf = fromIntegral getPrec :: Float
+				in
+					round(mf/cf) * getPrec
+			hourNow :: Int
+			hourNow = read $ fst (break (==':') now)
+			minNow :: Int
+			minNow = read $ drop 1 $ snd (break (==':') now)
+			hourEnd :: Int
+			hourEnd = read $ fst (break (==':') end)
+			minEnd :: Int
+			minEnd = read $ drop 1 $ snd (break (==':') end)
+			minsDiff :: Int
+			minsDiff = (hourEnd*60 + minEnd) - (hourNow*60 + minNow)
+			getPrec :: Int
+			getPrec
+				| abs minsDiff > 270	= 60
+				| abs minsDiff > 90		= 30
+				| abs minsDiff > 45		= 15
+				| abs minsDiff > 5		= 5
+				| otherwise				= 1
+
+
+-- | Capitalizes the string in one of the four ways: 0. all small; 1. default; 2. sentence case; 3. all caps
+capsizeDef :: Int -> String -> String
+capsizeDef caps str
+	| caps == 0 	= map toLower str
+	| caps == 2		= concat . intersperse " " $ map (\w -> toUpper (head w) : tail w) (words str)
+	| caps == 3		= map toUpper str
+	| otherwise		= str
+
+
+-- | Makes sure that noon is always represented as 0, and midnight – always as 0 or 24 (depending on the clock).
+nextFTHour :: FuzzyTime -> Int
+nextFTHour (FuzzyClock am _ clock hour _ _ _)
+	| clock == 12 && hour == 11		= if am then 12 else 0
+	| clock == hour					= 1
+	| otherwise						= hour + 1
+nextFTHour (FuzzyTimer _ _) = 0		-- this should never happen; just to get rid of the warning
+
+
+-- | Reports whether timer is now at zero. (Needed for the interface to know when to play a sound.)
+isTimerZero :: FuzzyTime -> Bool
+isTimerZero (FuzzyClock _ _ _ _ _ _ _)	= False
+isTimerZero (FuzzyTimer _ mins)			= mins == 0
+
+
+-- FuzzyTimeConf ===================================================================================================================================================================
+
+
+-- | Data for CmdArgs. Has the two modes of module FuzzyTime: showing the current time and showing the time left. Note that this is not the same as the two modes of module Main.
+data FuzzyTimeConf
+	= ClockConf {
+	  caps	:: Int
+	, clock	:: Int
+	, lang	:: String
+	, prec	:: Int
+	, time	:: Time
+	, style	:: Int
+	}
+	| TimerConf {
+	  end	:: Time
+	, lang	:: String
+	, now	:: Time
+	}
+	deriving (Data, Show, Typeable)
diff --git a/src/FuzzyTime.hs-boot b/src/FuzzyTime.hs-boot
new file mode 100644
--- /dev/null
+++ b/src/FuzzyTime.hs-boot
@@ -0,0 +1,55 @@
+module FuzzyTime (
+	  FuzzyTime (..)
+	, capsizeDef
+	, toFuzzyTime
+	, isTimerZero
+	, nextFTHour
+	, FuzzyTimeConf (..)
+	, Time
+	) where
+
+
+import Data.Data ()
+
+
+type Time = String
+
+data FuzzyTime
+	= FuzzyClock {
+	  ftAm		:: Bool
+	, ftCaps	:: Int
+	, ftClock	:: Int
+	, ftHour	:: Int
+	, ftLang	:: String
+	, ftMin		:: Int
+	, ftStyle	:: Int
+	}
+	| FuzzyTimer {
+	  ftLang	:: String
+	, ftMins	:: Int
+	}
+
+
+toFuzzyTime :: FuzzyTimeConf -> FuzzyTime
+
+capsizeDef :: Int -> String -> String
+
+isTimerZero :: FuzzyTime -> Bool
+
+nextFTHour :: FuzzyTime -> Int
+
+
+data FuzzyTimeConf
+	= ClockConf {
+	  caps	:: Int
+	, clock	:: Int
+	, lang	:: String
+	, prec	:: Int
+	, time	:: Time
+	, style	:: Int
+	}
+	| TimerConf {
+	  end	:: Time
+	, lang	:: String
+	, now	:: Time
+	}
diff --git a/src/fuzzytime.1 b/src/fuzzytime.1
new file mode 100644
--- /dev/null
+++ b/src/fuzzytime.1
@@ -0,0 +1,317 @@
+.TH fuzzytime 1 "April 22, 2011" "version 0.7.3" "A fuzzy clock and timer"
+
+.\" -------------------------------------------------------------------------------------
+
+.SH NAME
+fuzzytime \- a clock and timer that tell the time in a more human way
+
+.\" -------------------------------------------------------------------------------------
+
+.SH SYNOPSIS
+.B fuzzytime
+COMMAND [OPTIONS]
+
+.\" -------------------------------------------------------------------------------------
+
+.SH DESCRIPTION
+Humans tend to be much more casual than computers when it comes to telling the time. The computers’ usual "22:15"-format requires a little extra processing as compared to the more familiar "quarter past ten".
+.PP
+fuzzytime attempts to remove this obstacle by telling you the time the way that a human would.
+.PP
+fuzzytime is neither the first nor the only program which can do this, but it hopes to get closer to the goal than others because the author is a linguist and expects that this should help him come up with localizations which do not sound like MS® Translator. Besides, it also has the timer mode which can be very handy.
+
+.\" -------------------------------------------------------------------------------------
+
+.SH INTENDED USE
+The intended use for fuzzytime is in an environment which does not provide a status bar with a built-in clock. It is expected to be piped to a status bar and run every minute or so in the clock mode.
+.PP
+The timer can be set via the timer-setting mode. When the timer is set, the clock mode will show how much time there is left till some event. To get back to showing the actual time, timer has to be unset.
+.SS Example:
+Say you have fuzzytime piped to your status bar and it serves as a usual clock applet. Then you got an e-mail saying that you're going to have a meeting at one o'clock. You set the timer to 13:00 and instead of the current time, fuzzytime begins to show you how much time you have left till the meeting. After you come back, you unset the timer and have fuzzytime display the current time again.
+
+.\" -------------------------------------------------------------------------------------
+
+.SH OPTIONS
+.SS Modes
+.TP
+There are two: time-showing (clock) and timer-setting (timer). The name of the mode has to be put after the program name in the invocation, and before the options. See below for separate descriptions of both.
+
+.SS Clock mode (print the time)
+.TP
+    \--caps
+Capital letters; should be between 0 and 3; the default is one. Does not affect timer.
+0: all lowercase; 1: default for the lang; 2: Title Case; 3: ALL CAPS.
+.TP
+\-c \--clock
+12 or 24-hour clock (22:00 -> "ten" or "twenty-two"); the default is 12. Does not affect timer.
+.TP
+\-l \--lang
+Language; currently Danish (da), Dutch (nl), English (en), French (fr), German (de), Greek (el), Norwegian (nb), Polish (pl), Spanish (es), Swedish (se) and Turkish (tr); the default is en. Affects timer.
+.TP
+\-p \--prec
+Precision; should be between 1 and 60 [minutes]; the default is 5. Does not affect timer.
+.TP
+\-t \--time
+Time to fuzzify as HH:MM; the default is the current time. Affects timer.
+.TP
+\-s \--style
+How the time is told; see below; the default is 1. Does not affect timer.
+.TP
+\-? \--help
+Display help message
+.TP
+\-V \--version
+Print version information
+
+.SS Timer mode (set the timer)
+.TP
+END
+The time to set the timer to count down to, as HH:MM; this is obligatory and there is no default. To unset the timer, END must be "unset".
+
+.\" -------------------------------------------------------------------------------------
+
+.SH EXAMPLES
+.TP
+Print the current time in Polish in 12-hour clock, with 10-minute precision, in style 2.
+.B fuzzytime clock
+\-lpl -p10 -s2
+.PP
+.TP
+Print 23:50 in German in 24-hour clock, with 1-minute precision, in style 1.
+.B fuzzytime clock
+\-c24 -lde -p1 -t23:50
+.PP
+.TP
+Set the timer to count down to 12:30 (showing the time will be disabled).
+.B fuzzytime timer
+12:30
+.PP
+.TP
+Unset the timer (re-enable showing the time).
+.B fuzzytime timer
+unset
+
+.\" -------------------------------------------------------------------------------------
+
+.SH STYLES
+In many languages, the time can be told in at least a few ways. E.g., in English the words "midnight" and "noon" can be used, the numerals "twenty-four" and "twelve" or "twelve" for both cases. The latter distinction is taken care of by --clock. The former – by --style. Currently, two styles are available. See LANGUAGES below for details.
+
+As of now, styles are not available (= the setting is ignored) in the timer mode.
+
+.\" -------------------------------------------------------------------------------------
+
+.SH LANGUAGES
+
+.SS Comparison
+                                                       halves
+              midnight  noon    half   quarter  hour    base   am/pm
+
+Danish
+    style 1      –        –       +       +      –       –       –
+    style 2    [≠ 30]     –       +       +      –       –       –
+
+Dutch
+    style 1      –        –       +       +     [0]      –       –
+    style 2    [≠ 30]     –       +       +     [0]    [±10]     –
+
+English
+    style 1      –        –       +       +      –       –       –
+    style 2      +        +       +       +      –       –       –
+
+French
+    style 1      –        –       +       +      +       –       –
+    style 2      +        +       +       +      +       –       –
+
+German
+    style 1      –        –       +       +     [0]      –       –
+    style 2    [≠ 30]     –       +       +     [0]     [±7]     –
+    style 3    [≠ 30]     –       +     [next]  [0]     [±7]     –
+
+Greek
+                 –        –       +       +      –       –       –
+
+Norwegian
+    style 1      –        –       +       +      –     [±10]     –
+    style 2      +        –       +       +      –     [±10]     –
+
+Polish
+    style 1      –        –       +       +      –       –       –
+    style 2    [≠ 30]     –       +       +      –      [±7]     –
+
+Spanish
+    style 1      –        –       +       +      –       –       –
+    style 2      +        –       +       +      –       –       –
+    style 3      +        –       +       +      –       –   [13/21/0]
+
+Swedish
+    style 1      –        –       +       +      –      [±7]     –
+	style 2      +        –       +       +      –      [±7]     –
+
+Turkish
+    style 1      –        –       +       + [0, 12:30]   –       –
+    style 2      –        –       +       + [0, 12:30] [±10]     –
+
+.SS Notes
+
+midnight, noon: the words "midnight" and "noon" are used; [≠ 30]: the word is used except for halves.
+
+half, quarter: min % 15 = 0 is treated as a special case; [next]: quarters are always counted in reference to the next hour (German style 3).
+
+hour: the word "hour" is used; [0]: the word is only used for round hours; [0, 12:30]: the word is only used for round hours, 12:30 and 0:30.
+
+halves base: min in a certain range around 30 is referred to half hours rather than to full ones.
+
+am/pm: the words "in the morning/…" are used; [13/21/0]: morning is considered to last till hour is < 13, afternoon till hour is < 21, and night till hour is < 0 (= 24).
+
+.SS Examples
+
+.TP
+Danish (thanks M_ller)
+Style 1: 11:45 = 23:45 = kvart i tolv.
+.IP
+Style 2: 11:30 = halv tolv, 11:45 = kvart i tolv, 23:30 = halv tolv, 23:45 = kvart i midnat.
+.IP
+Timer: translation needed
+
+.TP
+Dutch (thanks Boris27 and litemotiv)
+Style 1: 11:45 = 23:45 = kwart voor twaalf.
+.IP
+Style 2: 11:30 = half twaalf, 11:45 = kwart voor twaalf, 23:30 = half twaalf, 23:45 = kwart voor middernacht, 10:20 = tien voor half elf
+.IP
+Timer: translation needed
+
+.TP
+English
+Style 1: 11:45 = 23:45 = Quarter to Twelve.
+.IP
+Style 2: 11:45 = Quarter to Noon, 23:45 = Quarter to Midnight.
+.IP
+Timer: 90 = in an hour and a half, 15 = in a quarter, -20 = ! twenty minutes ago !
+
+.TP
+French
+Style 1: 11:45 = 23:45 = douze heures moins le quart.
+.IP
+Style 2: 11:45 = midi moins le quart, 23:30 = onze heures et demie, 23:45 = minuit moins le quart.
+.IP
+Timer: 90 = dans une heure et demie, 15 = dans un quart d’heure, -20 = ! il y a vingt minutes !
+
+.TP
+German (thanks Clad in the sky, ichbinsisyphos and marens)
+Style 1: 11:45 = 23:45 = Viertel vor zwölf.
+.IP
+Style 2: 11:30 = halb zwölf, 11:45 = Viertel vor zwölf, 23:30 = halb zwölf, 23:45 = Viertel vor Mitternacht, 10:25 = fünf vor halb elf.
+.IP
+Style 3: 10:15 = Viertel elf, 10:45 = Dreiviertel elf.
+.IP
+Timer: 90 = in eineinhalb Stunden, 15 = in einer Viertel Stunde, -20 = ! vor zwanzig Minuten !
+
+.TP
+Greek (thanks Gbak)
+Clock: 11:45 = 23:45 = δώδεκα παρά τέταρτο.
+.IP
+Timer: translation needed
+
+.TP
+Norwegian (thanks arnvidr)
+Style 1: 11:45 = 23:45 = kvart på tolv, 10:20 = ti på halv elleve.
+.IP
+Style 2: 11:30 = halv tolv, 11:45 = kvart på tolv, 23:30 = halv midnatt, 23:45 = kvart på midnatt, 10:20 = ti på halv elleve.
+.IP
+Timer: 90 = om halvannen time, 15 = om en kvarter, -20 = ! for tjue minutter siden !
+
+.TP
+Polish
+Style 1: 11:45 = 23:45 = za kwadrans dwunasta.
+.IP
+Style 2: 11:30 = w pół do dwunastej, 11:45 = za kwadrans dwunasta, 23:30 = w pół do dwunastej, 23:45 = za kwadrans północ, 10:25 = za pięć w pół do jedenastej.
+.IP
+Timer: 90 = za półtorej godziny, 15 = za kwadrans, -20 = ! dwadzieścia minut temu !
+
+.TP
+Spanish (thanks xenofungus and itsbrad212)
+Style 1: 11:45 = 23:45 = las doce menos cuarto.
+.IP
+Style 2: 11:30 = las once y media, 11:45 = las doce menos cuarto, 23:30 = las once y media, 23:45 = la medianoche.
+.IP
+Style 3: 11:30 = las once y media de la mañana, 13:00 = la una de la tarde, 23:30 = las once y media de la noche.
+.IP
+Timer: translation needed
+
+.TP
+Swedish (thanks Closey)
+Style 1: 11:45 = 23:45 = kvart i tolv, 10:25 = fem i halv elva.
+.IP
+Style 2: 11:30 = halv tolv, 11:45 = kvart i tolv, 23:30 = halv midnatt, 23:45 = kvart i midnatt, 10:25 = fem i halv elva.
+.IP
+Timer: 90 = ome en och en halv timme, 15 = om en kvart, -20 = ! för tjugo minuter sedan !
+
+.TP
+Turkish
+Style 1: 11:45 = 23:45 = on ikiye çeyrek var.
+.IP
+Style 2: 12:00 = saat on iki, 12:30 = saat yarım, 11:20 = on bir buçuğa on var, 12:25 = on iki buçuğa beş var.
+.IP
+Timer: 90 = bir buçuk saat sonra, 15 = bir çeyrek sonra, -20 = ! yirmi dakika önce !
+
+.\" -------------------------------------------------------------------------------------
+
+.SH TIMER
+Timer is, like the rest of the program, fuzzy. Precision is not constant and grows give or take logarithmically. The exact intervals are as follows:
+
+   interval     precision
+
+   >4:30 h       60 m
+ 4:30–1:30 h     30 m
+ :45–1:15 h      15 m
+  :05–:40 h       5 m
+  :01–:05 h       1 m
+
+.\" -------------------------------------------------------------------------------------
+
+.SH DEPENDENCIES
+(Arch Linux) ghc, haskell-cmdargs
+
+.SS Optional
+(Arch Linux) alsa-utils (aplay) for the timer sound
+
+.\" -------------------------------------------------------------------------------------
+
+.SH BUGS
+No known bugs at this time.
+
+.\" -------------------------------------------------------------------------------------
+
+.SH AUTHOR
+Kamil Stachowski (kamil.stachowski@gmail.com)
+
+The crow sound has been recorded by PsychoBird and uploaded to http://soundbible.com/1486-Black-Crows-Cawing.html under the rules of the Attribtion 3.0 license [downloaded by KS 2011.01.23]
+
+.SS Thanks
+
+arnvidr from forums.gentoo.org for Norwegian.
+
+Boris27 from forums.gentoo.org for Dutch.
+
+Brent Yorger from beginners@haskell.org for Haskell help.
+
+Clad in the sky from forums.gentoo.org for German.
+
+Closey from forums.gentoo.org for Swedish.
+
+Daniel Fischer from beginners@haskell.org for Haskell help.
+
+Gbak from bbs.archlinux.org for Greek.
+
+ichbinsisyphos from forums.gentoo.org for German.
+
+itsbrad212 from bbs.archlinux.org for Spanish.
+
+litemotiv from bbs.archlinux.org for Dutch.
+
+marens from forums.gentoo.org for German.
+
+M_ller from bbs.archlinux.org for Danish.
+
+xenofungus from bbs.archlinux.org for Spanish.
diff --git a/src/fuzzytime.hs b/src/fuzzytime.hs
new file mode 100644
--- /dev/null
+++ b/src/fuzzytime.hs
@@ -0,0 +1,276 @@
+{- |
+fuzzytime is a small utility which tells what time it is or how much time there is left till something happens, in a more familiar way such as "ten to six" rather than 17:51 (telling the time), or "in five minutes" (telling the left time).
+
+There are two modes: telling the time / the time left till some event, and setting the timer. See main below.
+
+The intended use is in an environment which does not provide a status bar with a built-in clock. It is expected to be piper to a status bar and run every minute or so in the clock mode.
+The timer can be set via the timer-setting mode. When the timer is set, the clock mode will show how much time there is left till some event. To get back to showing the actual time, timer has to be unset.
+
+Example use:
+Say you have fuzzytime piped to your status bar and it serves as a usual clock applet. Then you got an e-mail saying that you're going to have a meeting at one o'clock. You set the timer to 13:00 and instead of the current time, fuzzytime begins to show you how much time you have left till the meeting. After you come back, you unset the timer and have fuzzytime display the current time again.
+
+More technically, this module provides an interface to FuzzyTime which does all the conversion from time to string.
+
+Depends on N. Mitchell's System.Console.CmdArds 0.6.4-1+.
+
+To add a new language, two things need to be done:
+(1) The new language needs to be added to confAvailLangs in fuzzytime.hs.
+(2) A module FuzzyTime.NewLanguge needs to be created and added to the list of imports and to the instance Show FuzzyTime in FuzzyTime.hs.
+-}
+
+
+-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+---- |
+---- Module			: Main
+---- Copyright		: (C) Kamil Stachowski <kamil.stachowski@gmail.com>
+---- License		: GPL3+
+---- Maintainer		: Kamil Stachowski <kamil.stachowski@gmail.com>
+---- Stability		: unstable
+---- Portability	: unportable
+---- A clock that ells the time in a more human way (the \"ten past six\"-style).
+-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+{-# LANGUAGE DeriveDataTypeable #-}
+
+module Main (
+	  main
+	) where
+
+
+import Control.Monad (when)
+import Data.Char (isDigit)
+import Data.List (intercalate)
+import Directory (removeFile)
+import System.Cmd (system)
+import System.Console.CmdArgs
+import System.Environment (getEnv)
+import System.Exit (ExitCode (ExitFailure), exitFailure)
+import System.Time (getClockTime)
+
+import FuzzyTime
+
+
+-- config =========================================================================================================================================================================
+
+-- available ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+
+-- | \[config] Languages available.
+confAvailLangs :: [String]
+confAvailLangs = ["da", "de", "el", "en", "es", "fr", "nb", "nl", "pl", "se", "tr"]
+
+
+-- defaults -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+
+-- | \[config] The default language.
+confDefLang :: String
+confDefLang = "en"
+
+-- | \[config] The default for capitals (should be in [0..3]; see the man page). Clock mode only.
+confDefClockCaps :: Int
+confDefClockCaps = 1
+
+-- | \[config] The default clock (12 vs. 24-hour) for the clock mode.
+confDefClockClock :: Int
+confDefClockClock = 12
+
+-- | \[config] The default precision (should be in [1..60]) for the clock mode.
+confDefClockPrec :: Int
+confDefClockPrec = 5
+
+-- | \[config] The default style for the clock mode (see the man page).
+confDefClockStyle :: Int
+confDefClockStyle = 1
+
+
+-- | \[config] Get the default config for showing the time.
+getDefClockConf :: IO FuzzyTimeConf
+getDefClockConf = do
+	nowClock <- getClockTime
+	let nowString = take 5 . drop 11 $ show nowClock
+	return $ ClockConf {
+		  caps	= confDefClockCaps	&= help confHelpClockCaps
+		, clock	= confDefClockClock	&= help confHelpClockClock	&= name "c"
+		, lang	= confDefLang		&= help confHelpClockLang
+		, prec	= confDefClockPrec	&= help confHelpClockPrec
+		, time	= nowString			&= help confHelpClockTime
+		, style	= confDefClockStyle	&= help confHelpClockStyle
+		} &= name "clock" &= help confHelpClock
+
+-- | \[config] Get the default config for either showing the time or setting the timer.
+getDefTimerConf :: IO FuzzyTimeConf
+getDefTimerConf = do
+	nowClock <- getClockTime
+	let nowString = take 5 . drop 11 $ show nowClock
+	endFile <- (readFile =<< confTimerFileLoc) `catch` (\_ -> return "empty")
+	let endString = take 5 endFile
+	return $ TimerConf {
+		  end	= endString			&= args &= typ "END"
+		, lang	= confDefLang		&= ignore				-- will be taken from ClockConf anyway
+		, now	= nowString			&= ignore				-- will be taken from ClockConf anyway
+		} &= name "timer" &= help confHelpTimer
+
+
+-- internal -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+
+-- | \[config] The default location for the timer file.
+confTimerFileLoc :: IO String
+confTimerFileLoc = do
+	home <- getEnv "HOME"
+	return $ home ++ "/.fuzzytimer"
+
+
+-- | \[config] The default command for playing the timer sound.
+confTimerSoundCmd :: String
+confTimerSoundCmd = "aplay /usr/share/fuzzytime/sound.wav &> /dev/null"
+
+
+-- | Print nicely what languages are available.
+showAvailLangs :: String -> String
+showAvailLangs i = case length confAvailLangs of
+						0	-> "none"
+						1	-> head confAvailLangs
+						_	-> intercalate ", " (init confAvailLangs) ++ " " ++ i ++ " " ++ last confAvailLangs
+
+
+-- help ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+
+-- | \[config] Help message for the clock (showing) mode.
+confHelpClock :: String
+confHelpClock = "Print fuzzy time if timer is not set, and countdown if it is."
+
+-- | \[config] Help message for --caps.
+confHelpClockCaps :: String
+confHelpClockCaps = "Capital letters; default " ++ show confDefClockCaps ++ " (see the man page)."
+
+-- | \[config] Help message for --clock.
+confHelpClockClock :: String
+confHelpClockClock = "12 or 24-hour clock; default " ++ show confDefClockClock ++ "-hour."
+
+-- | \[config] Help message for --lang.
+confHelpClockLang :: String
+confHelpClockLang = "Language (currently " ++ showAvailLangs "and" ++ "); default " ++ confDefLang ++ "."
+
+-- | \[config] Help message for --prec.
+confHelpClockPrec :: String
+confHelpClockPrec = "Precision (1 <= prec <= 60 [minutes]); default " ++ show confDefClockPrec ++ "."
+
+-- | \[config] Help message for --time.
+confHelpClockTime :: String
+confHelpClockTime = "Time to fuzzify as HH:MM; default current time." 
+
+-- | \[config] Help message for --style.
+confHelpClockStyle :: String
+confHelpClockStyle = "How the time is told (see the man page); default " ++ show confDefClockStyle ++ "."
+
+
+-- | \[config] Help message for the timer (setting) mode.
+confHelpTimer :: String
+confHelpTimer = "Set timer to END as HH:MM or \"unset\". (Disables printing time.)"
+
+
+-- | \[config] Help message for program
+confHelpProgram :: String
+confHelpProgram = "fuzzytime"
+
+-- | \[config] Help message for summary
+confHelpSummary :: String
+confHelpSummary = "A clock and timer that tell the time in a more human way.\nv0.7.3, 2011.04.22, kamil.stachowski@gmail.com, GPL3+"
+
+
+-- check --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+
+-- | \[config] Check that arguments given at cli or read from the timer file are correct.
+checkFTConf :: FuzzyTimeConf -> Either String FuzzyTimeConf
+
+checkFTConf c@(ClockConf caps clock lang prec time style)
+	| caps < 0 || caps > 3			= Left "--caps must be in [0..3] (see the man page)."
+	| clock `notElem` [12, 24]		= Left "--clock must be either 12 or 24."
+	| lang `notElem` confAvailLangs = Left ("--lang must be " ++ showAvailLangs "or" ++ ".")
+	| prec < 1 || prec > 60			= Left "--prec must be in [1..60]."
+	| not (checkTimeOk time)		= Left "--time must be given as HH:MM, where HH is in [0..23] and MM is in [0..59]."
+	| style < 1 || style > 3		= Left "--style must be in [1..3] (see the man page)."
+	| otherwise						= Right c
+
+checkFTConf t@(TimerConf aEnd _ aNow)
+	| not (checkTimeOk aEnd)
+		&& aEnd /= "unset"		= Left "END must be given and in the same format as --time."
+	| not (checkTimeOk aNow)	= Left "--time must be given as HH:MM, where HH is in [0..23] and MM is in [0..59]."
+	| otherwise					= Right t
+
+
+-- | \[config] Check that a string is a properly formatted time (HH:MM).
+checkTimeOk :: Time -> Bool
+checkTimeOk t = case break (== ':') t of
+	(hh, _:mm)	->	not (null hh || null mm)
+					&& all isDigit hh && all isDigit mm
+					&& (let h = read hh :: Int; m = read mm :: Int
+						in 0 <= h && h < 24 && 0 <= m && m < 60)
+	_			->	False
+
+
+-- other --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+
+exitWithError :: String -> IO ()
+exitWithError err = do
+	putStrLn err
+	exitFailure
+
+
+-- main ===========================================================================================================================================================================
+
+
+-- | There are two modes: telling the time, and setting the timer.
+-- Telling the time happens when invoked as "fuzzytime clock". If the timer is set (if ~/.fuzzytimer exists), the countdown is shown. Otherwise, time is shown.
+-- Setting the timer happens when invoked as "fuzzytime timer END", where END can be either the time to countdown to (as HH:MM), or "unset" to disable the timer.
+-- Note that they are different from the two modes of FuzzyTime: telling the time can invoke both FuzzyTime's ClockConf and TimerConf, and setting the timer only happens here.
+main :: IO ()
+main = do
+	clockConf <- getDefClockConf
+	timerConf <- getDefTimerConf
+	conf <- cmdArgs (modes [clockConf, timerConf] &= program confHelpProgram &= summary confHelpSummary)
+	case conf of
+		(ClockConf _ _ _ _ _ _)	-> runModeShow $ if end timerConf == "empty" then
+														conf
+														else
+														timerConf {
+															lang = lang conf,
+															now = time conf
+														}
+		tc@(TimerConf _ _ _)	-> runModeTimer tc
+
+
+-- modes --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+
+-- | The time-showing mode.
+runModeShow :: FuzzyTimeConf -> IO ()
+runModeShow conf =
+	case checkFTConf conf of
+		Left e	->	exitWithError e
+		Right c	->	do
+					let ftime = toFuzzyTime c
+					when (isTimerZero ftime) (do _ <- system confTimerSoundCmd; return ())
+					print ftime
+
+
+-- | The timer-setting mode.
+runModeTimer :: FuzzyTimeConf -> IO ()
+runModeTimer conf@(TimerConf end _ _) =
+	case checkFTConf conf of
+		Left e	-> 	exitWithError e
+		Right _	->	do
+					path <- confTimerFileLoc
+					removeFile path `catch` (\_ -> return ())
+					if end == "unset" then
+						putStrLn "Timer has been unset."
+						else do
+						writeFile path end
+						putStrLn $ "Timer has been set to " ++ end ++ "."
+runModeTimer (ClockConf _ _ _ _ _ _) = exitWithError "The timer mode shouldn't have been given a ClockConf."
diff --git a/src/sound.wav b/src/sound.wav
new file mode 100644
Binary files /dev/null and b/src/sound.wav differ
