More idiomatic haskell code.