Restructuring the code