refactor and expose topology builder