sort images alphabetically and use list comprehension instead of for