Replace the lambda and map with a list comprehension