Restructuring logic