redesign the architechure of the code