Removed memory leak from copy function - I am still planning on deleting it when I get the chance