; and (B) the number of visas not required for the class specified in paragraph (1). . (b) Protecting children from aging out Section 203(h) of the Immigration and Nationality Act ( 8 U.S.C. 1153(h) ) is amended— (1) by amending paragraph (1) to read as follows: (1) In general For purposes of subsection (d), a determination of whether an alien satisfies the age requirement in the matter preceding subparagraph (A) of section 101(b)(1) shall be made using the age of the alien on the date on which the petition is filed with the Secretary of Homeland Security under section 204. ; (2) by amending paragraph (2) to read as follows: (2) Petitions described A petition described in this paragraph is a petition filed under section 204 for classification of— (A) the alien’s parent under subsection (a), (b), or (c); or (B) the alien as an immediate relative based on classification as a child of— (i) a citizen of the United States; or (ii) a lawful permanent resident. ; (3) in paragraph (3), by striking subsections (a)(2)(A) and and inserting subsection ; and (4) by adding at the end the following: (5) Treatment for nonimmigrant categories purposes An alien dependent treated as a child for immigrant visa purposes under this subsection shall be treated as a dependent child for nonimmigrant categories. . (c) Conforming amendments (1) Definitions Section 101(a)(15)(K)(ii) of the Immigration and Nationality Act ( 8 U.S.C. 1101(a)(15)(K)(ii) ) is amended by striking section 201(b)(2)(A)(i) and inserting section 201(b)(2) (other than clause (v) or (vi) of subparagraph (B)) . (2) Rules for determining whether certain aliens are immediate relatives Section 201(f) of the Immigration and Nationality Act ( 8 U.S.C. 1151(f) ) is amended— (A) in paragraph (1), by striking paragraphs (2) and (3), and inserting paragraph (2), ; (B) by striking paragraph (2); (C) by redesignating paragraphs (3) and (4) as paragraphs (2) and (3), respectively