Modified function to allow addition of multiple image files