More haskell refactor