Use a list comprehension to avoid the flatten step