Removed Haskell spaghetti code