Fixing deep nesting problem