Reorganization of code