Refactored Main.hs.