Added a loop for processing multiple images