restructuring code layout