Some source code reorganization