Adapted to using list comprehension