Reorganization of the code