reorganization code