changed for loops with fancy list comprehensions