reorganization and a touch of refactoring