Start converting script into Haskell