Refactored Haskell controller