reorganization and refactor