Begun to fix derive best topologies function