More legible code. Return is now a dictionary with information about the images.