Dynamic topology

This PR is on top of PR #64. It adds completely dynamic topology.