Restructuring business logic