third step restructuring code