Restructuring code