added max nesting level