refactor the topology

@xiaoyunwu