refactored 20/Haskell for clarity