add function: getInstancesTree()