Updated the copy function.