; and (4) to the greatest extent practicable, complete construction, modernization, or retrofitting of replacement dwellings prior to demolishing existing public housing units. (f) Profits related to community energy generation (1) In general With respect to any energy produced by an eligible entity carrying out activities described in subsection (a)(2)(B)(iii), the eligible entity may retain 90 percent of any profits earned from selling the energy. (2) Vote An eligible entity described paragraph (1) with not less than 50 public housing dwelling units shall provide residents of the public housing the opportunity to vote on how the profits earned under paragraph (1) shall be used. (3) Other revenue Any profits not retained under this subsection shall be transferred to the Department of the Treasury for deposit in the General Fund. (g) Labor and Buy American provisions (1) In general In carrying out grant activities under this section, each contractor or subcontractor for a project funded under this section shall carry out the following: (A) Ensure that the materials used by the contractor or subcontractor are substantially manufactured, mined, and produced in the United States in accordance with chapter 83 of title 41, United States Code (commonly known as the Buy American Act ). (B) Ensure that all laborers and mechanics employed by the contractor or subcontractor in the performance of construction, alteration, or repair work financed in whole or in part with assistance under this section shall be paid wages at rates not less than those prevailing on similar construction in the locality, as determined by the Secretary of Labor, in accordance with subchapter IV of chapter 31 of title 40, United States Code (commonly known as the Davis-Bacon Act ). With respect to the labor standards in this subparagraph, the Secretary of Labor shall have the authority and functions set forth in Reorganization Plan Numbered 14 of 1950 (64 Stat. 1267