more refactoring of topology code
8 files changed