Created a struct for image and consequently modified the code