Update deprecated list comprehension to for syntax