refactoring to support multiple topologies - wip