the other members of the group which are not so excepted, and (D) for the application of this subsection in the case of pass thru entities and for the treatment of pass thru entities as corporations in cases where necessary to prevent the avoidance of the purposes of this subsection. . (b) Coordination with limitation on related party indebtedness Paragraph (2) of section 163(j) of the Internal Revenue Code of 1986 is amended by adding at the end the following new subparagraph: (D) Coordination with limitation on excess domestic indebtedness This subsection shall not apply to any corporation for any taxable year to which subsection (n) applies to such corporation. . (c) Effective date The amendments made by this section shall apply to taxable years beginning after December 31, 2016. 106. Treatment of foreign corporations managed and controlled in the United States as domestic corporations (a) In general Section 7701 is amended by redesignating subsection (p) as subsection (q) and by inserting after subsection (o) the following new subsection: (p) Certain corporations managed and controlled in the United States treated as domestic for income tax (1) In general Notwithstanding subsection (a)(4), in the case of a corporation described in paragraph (2) if— (A) the corporation would not otherwise be treated as a domestic corporation for purposes of this title, but (B) the management and control of the corporation occurs, directly or indirectly, primarily within the United States, then, solely for purposes of chapter 1 (and any other provision of this title relating to chapter 1), the corporation shall be treated as a domestic corporation. (2) Corporation described (A) In general A corporation is described in this paragraph if— (i) the stock of such corporation is regularly traded on an established securities market, or (ii) the aggregate gross assets of such corporation (or any predecessor thereof), including assets under management for investors, whether held directly or indirectly, at any time during the taxable