Added support for circular object references

initial commit of these changes; still needs testing