refactor topology