Reducing nesting depth