Handle circular refrences

This seems to handle circular references of objects and arrays.
A more capable means of cloning.