changed ugly loop to list comprehension, python ftw