Small code reorganization