Restructured architecture into more functions