refactoring / code reorganization