Much simpler nesting level detection