Improvements to downloadPhotos function.