extract method buildTopology