Adding S3 retrieval for images (very slow, needs optimization)