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, 2017. 7. Modifications to rules relating to inverted corporations (a) In general Subsection (b) of section 7874 of the Internal Revenue Code of 1986 is amended to read as follows: (b) Inverted corporations treated as domestic corporations (1) In general Notwithstanding section 7701(a)(4), a foreign corporation shall be treated for purposes of this title as a domestic corporation if— (A) such corporation would be a surrogate foreign corporation if subsection (a)(2) were applied by substituting 80 percent for 60 percent , or (B) such corporation is an inverted domestic corporation. (2) Inverted domestic corporation For purposes of this subsection, a foreign corporation shall be treated as an inverted domestic corporation if, pursuant to a plan (or a series of related transactions)— (A) the entity completes after May 8, 2014, the direct or indirect acquisition of— (i) substantially all of the properties held directly or indirectly by a domestic corporation, or (ii) substantially all of the assets of, or substantially all of the properties constituting a trade or business of, a domestic partnership, and (B) after the acquisition, more than 50 percent of the stock (by vote or value) of the entity is held— (i) in the case of an acquisition with respect to a domestic corporation, by former shareholders of the domestic corporation by reason of holding stock