Function to upload networks; this one was messy