Make cloning structured with cycles in references possible

Make cloning structured with cycles in references possible
Merge branch 'UT-Refactor'