restructuring code