Use fmap instead of pattern matching