reorganization of the code