Added foreach loop to handle multiple copy entries