#5 added nesting infrastructure