Made the copy function dereference pointers