Refactored to use list comprehension