speedig up fuxns for network construction