Refactor using list comprehension