changes to deep clone and additional functions