More idiomatic haskell