simplifying logic for retrieving images.