refactor for multiple networks