Modified code to use array of images as init argument