added parent nesting tracking