Modified the code to prepare for the image downloading feature