Reestructuring code