cleaned up to network.R