Optimize list_images