Major overhaul, language changed to Haskell