account for circular references properly, closes #31

Cleans up the clone and compact methods to account for circular references properly
Aside from not crashing, please add a test to verify the resulting value