code changes in fixing nesting issue