Change append statements to list comprehensions