Restructurement of the code